Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sys(0)- does it now work??
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00113097
Message ID:
00113443
Vues:
24
>>Sys(0) has worked for me quite well. Another thing I get from using it is the current user name if on network environment (which is 100% of the time). Can you post corresponding API (for getting user name that is)? TIA
>
>I hope that Ed doesn't mind too much my posting this.

Why would I? You've got it right AFA the local user goes! You do more API stuff here than I do...


>FUNCTION CurrentUser
>
> DECLARE INTEGER WNetGetUser IN Win32API;
> STRING @lpszLocalName, STRING @lpszUserName,;
> INTEGER @lpcchBuffer
> LOCAL lcresult, lcbuffer, lnsize, lnerr, lnpt
> lcresult = ""
> lcbuffer = SPACE(200)
> lnsize = LEN(lcbuffer)
> lnerr = WNetGetUser(0, @lcbuffer, lnsize)
> * If lnerr doesn't equal 0 WNetGetLastError
> * should be called
> IF lnerr = 0
> lnpt = AT(CHR(0), lcbuffer)
> IF lnpt > 1
> lcresult = LEFT(lcbuffer, lnpt - 1)
> ENDIF
> ENDIF
> RETURN lcresult
>ENDFUNC
>hth,
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform