Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get user name from the operating system
Message
From
01/11/2002 08:32:28
Fabian Belo
Independent Developer
Argentina
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00717731
Message ID:
00717744
Views:
26
This message has been marked as the solution to the initial question of the thread.
This API returns Computer and User Name:
DECLARE INTEGER GetComputerName IN kernel32; 
    STRING  @ lpBuffer, INTEGER @ nSize 

DECLARE INTEGER GetUserName IN advapi32; 
    STRING  @ lpBuffer, INTEGER @ nSize 

nSize = 250 
lpBuffer = SPACE(nSize) 

IF GetComputerName (@lpBuffer, @nSize) > 0 
    lpBuffer = STRTRAN (SUBSTR (lpBuffer, 1, nSize), Chr(0),"") 
    ? "Computer: " + lpBuffer 
ENDIF 

nSize = 250 
lpBuffer = SPACE(nSize) 

IF GetUserName (@lpBuffer, @nSize) > 0 
    lpBuffer = STRTRAN (ALLTRIM(SUBSTR (lpBuffer, 1, nSize)), Chr(0),"") 
    ? "User: " + lpBuffer 
ENDIF 
>I have a client who's on W2K server. They want to create an audit trail in a program I wrote for them, which records user name. However, they don't want to have to have a log-in screen in the program I made (the network log-in is sufficient).
>
>How can I interrogate W2K to get the user name in VFP6?
>
>JR
"Since I've read that alcohol is bad... I quit reading."
Me


http://www.fabianbelo.com.ar
Previous
Reply
Map
View

Click here to load this message in the networking platform