Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Windows NT 4.0 UserName into a VFP 6.0 application?
Message
From
30/12/1999 05:13:38
 
 
To
29/12/1999 14:14:50
John Vlahos
V I Software Solutions Design
Mississauga, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00310006
Message ID:
00310276
Views:
21
>How can I get the UserName used to log on to a NT 4.0 Windows Workstation, into a VFP 6.0 application?
>
>Thanks in advance!

Hi John,

here comes my solution: (two related functions)

FUNCTION cGetUserName
LOCAL lcUserName, lnNameLength
DECLARE INTEGER GetUserName IN WIN32API STRING @lcUserName, INTEGER @lnNameLength
lcUserName=space(256)
lnNameLength=255
GetUserName(@lcUserName, lnNameLength)
IF at(chr(0),lcUserName,1)>0
lcUserNAme=left(lcUserName,at(chr(0),lcUserName,1)-1)
ENDIF
RETURN lcUserName


FUNCTION cGetComputerName
DECLARE INTEGER GetComputerName IN WIN32API STRING @lcComputerName, INTEGER @lnNameLength
LOCAL lcComputerName, lnNameLength
lcComputerName=space(256)
lnNameLength=255
GetComputerName(@lcComputerName, lnNameLength)
IF at(chr(0),lcComputerName,1)>0
lcComputerName=left(lcComputerName,at(chr(0),lcComputerName,1)-1)
ENDIF
RETURN lcComputerName



I hope this helps you.

bb
Previous
Reply
Map
View

Click here to load this message in the networking platform