Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get Username?
Message
 
To
06/02/2007 09:26:30
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01192741
Message ID:
01200628
Views:
18
The following code will return the current logged in username. Put the code into a prg and call it something like GetNetUser.
LOCAL  lpUserIDBuffer, nBufferSize, RetVal

RetVal         = 0
lpUserIDBuffer = SPACE(25) && Return buffer for user ID string
nBufferSize    = 25        && Size of user ID return buffer

DECLARE INTEGER GetUserName IN Win32API AS GetName ;
   STRING  @lpUserIDBuffer, ;
   INTEGER @nBufferSize

RetVal = GetName(@lpUserIDBuffer, @nBufferSize)

RETURN LEFT(lpUserIDBuffer,nBufferSize-1)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform