>Were in the resistery can I find out who is the current user?
>
>I have found UserName in HKEY_CURRENT_USER\Network\
for the login to the various servers and drives, but I need the userid for the WorkStation, which could be different.
>
>NOS is NOVELL versions 3.11 to 4 something, if it matters
It doesn't - your best bet is not the registry, but an API call; either GetUserName() or WNetGetUser() will get the login for the workstation; WNetGetUser() can also retrieve the username for an attached device (eg, what user name logged into the server drive mapped as H:). Both are documented in the MSDN. In VFP, the prototype for WNetGetUser() and GetUserName() look like:DECLARE INTEGER WNetGetUser IN WIN32API ;
STRING lpName, ;
STRING lpUserNameBuffer, ;
INTEGER @ lpnBufferSize
cDevice = 0 && Assign a string like "F:" or "LPT3: " to check
&& the network connection to the device
cBuf = SPACE(256)
nBufSize = 256
IF WNetGetUser(cDevice , @cBuf, @nBufSize) = 0
* it worked
? 'User is ' + LEFT(cBuf, MAX(0,nBufSize-1))
ENDIF
DECLARE INTEGER GetUserName IN WIN32API ;
STRING lpBuffer, ;
INTEGER @ lpSize
cBuf = SPACE(256)
nBufSize = 256
IF GetUserName(@cBuf, @nBufSize) # 0
* it worked
? 'User is ' + LEFT(cBuf, MAX(0,nBufSize-1))
ENDIF
You can also use the Wscript.Network object's UserName property if the Windows Scripting Host has been installed.
>
>thank you