Page 1 of 1

Function GetUserName

Posted: Mon Apr 13, 2009 3:24 pm
by mjbarranco
I have seen the example GetCompName to obtain the name of the computer.
Is there a similar function to obtain the name of the current user?
Thanks.

Function GetUserName

Posted: Wed Apr 15, 2009 11:37 am
by PaPi
Yes. It is the sample program:

yours PaPi



` example get Userneme by PaPi  15-04-2009
declare getUser_name as "GetUserNameA" of "advapi32.dll"
lpbuffer as string byaddress
nsize as integer byaddress
result as integer
end declare

getUser_name.nsize=255
getUser_name

showmessage field$(getUser_name.lpbuffer,chr$(0),1)
showmessage getUser_name.lpbuffer

Function GetUserName

Posted: Mon Apr 20, 2009 3:30 pm
by mjbarranco
Thank you very much. :)