Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I retrieve Network Login ID of a user.
Message
From
20/03/2000 16:57:06
 
 
To
20/03/2000 16:27:07
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00280948
Message ID:
00348124
Views:
36
>I found your message about the API calls, and the sys(0) and GetUserName work fine. However, they show you the name of the user who logged onto Windows, not the current user if there have been subsequent logins. I haven't figured out how to use GetNetUser function. Would it be necessary to get use a Novell library for this?
>
>If so, do you know of example of the syntax I would need to use?

You'd use the WNetGetUser() API call; if you know the name of either a local resource mapped to the server, or a valid UNC on the server that the user has requisite permissions to:
DECLARE INTEGER WNetGetUser IN MPR.DLL ;
  STRING @ lpRemoteResource, ;
  STRING @ lpUserBuffer, ;
 INTEGER @ lpdwBufferSize
cUNC='\\ServerName\ShareName'+CHR(0)  && you can use a mapped drive letter instead
cUserID = SPACE(261)
nSize = 260
IF WNetGetUser(cUNC,@cUserID,@nSize) = 0
   ? LEFT(cUserid,AT(CHR(0),cUserID)-1)
ENDIF
This works fine in an MS Network environment, properly identifying the domain and user login for a mapped drive or UNC. I have not tested it under an NDS environment.
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
Previous
Reply
Map
View

Click here to load this message in the networking platform