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:
00113389
Vues:
23
>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.
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,
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform