Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sys(0)- does it now work??
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00113097
Message ID:
00113389
Views:
21
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform