Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SYS(0) returns network name? Win2k name?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00746427
Message ID:
00746438
Views:
18
What a drag. Thanks Sergey, but I've just tried this and have gotten similar results as with SYS(0).

The Win2k *Windows* username is what is returned by GetUserName().
I want *network* username. Strangely, *network* username is being returned by SYS(0) on the Win98 machines. But SYS(0) on Win2k machines is returning the Windows username.


>Try
* Function GetUserName
>local lcBuffer, lnSize, lnRetCode, lcUserName
>lcBuffer = repl(chr(0),64)
>lnSize = LEN(lcBuffer) -1
>Declare Long WNetGetUserA in "mpr.dll" As GetUserName ;
>				STRING @lc0, STRING @lcBuffer, LONG @lnSize
>lnRetCode = GetUserName("", @lcBuffer, @lnSize )
>lcUserName = left(lcBuffer, at(chr(0), lcBuffer)-1)
>return lcUserName
>
>>Hi anyone,
>> I've got a boat-load of legacy apps to support which employ use of the SYS(0) function to obtain the *network* username. Now I'm testing a new username under Win98 and SYS(0) correctly returns the *network* username. However, lucky me, when using Win2k to log on with this new network username, I find that SYS(0) does *not* return the new network username -- it, and ID() as well, returns my Win2k *Windows* username. Duh?
>> Any similar experiences? Solutions to obtaining *network* username?
>>
>>Thanks,
>>Steven-
Previous
Reply
Map
View

Click here to load this message in the networking platform