>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only