>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
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement