AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Full name of local user account Windows XP

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ggirf14



Joined: 01 Nov 2005
Posts: 108
Location: Ottawa

PostPosted: Thu Jan 03, 2008 2:40 pm    Post subject: Full name of local user account Windows XP Reply with quote

Is there a way to retreive the full name of a local user account.
The following will only display the user name
MsgBox, %A_UserName%

I could not find information in the registry or on the forum (may have overlook).

Additional information:
In a Novell network the local user account is automaticly created when login to the network. I beleive the Full name of the user is coming from the Novell account information.
Back to top
View user's profile Send private message
wOxxOm



Joined: 09 Feb 2006
Posts: 326

PostPosted: Fri Jan 04, 2008 9:12 am    Post subject: Reply with quote

for the local user account this can be used:
Code:
msgbox % GetUserFullName( A_UserName )

GetUserFullName( usr="" )
{
   IfEqual,usr,
      usr=%A_UserName%
   StringLen,L,usr
   varSetCapacity(sUserW, L*2+2, 0)
   dllCall("MultiByteToWideChar","uint",0, "uint",0
            ,"str",usr, "uint",-1, "uint",&sUserW, "uint",L+1)

;typedef struct _USER_INFO_2 {
   usri2_nameW=0
   usri2_passwordW=4
   usri2_password_ageL=8
   usri2_privL=12
   usri2_home_dirW=16
   usri2_commentW=20
   usri2_flagsL=24
   usri2_script_pathW=28
   usri2_auth_flagsL=32
   usri2_full_nameW=36
   usri2_usr_commentW=40
   usri2_parmsW=44
   usri2_workstationsW=48
   usri2_last_logonL=52
   usri2_last_logoffL=56
   usri2_acct_expiresL=60
   usri2_max_storageL=64
   usri2_units_per_weekL=68
   usri2_logon_hours=72
   usri2_bad_pw_countL=76
   usri2_num_logonsL=80
   usri2_logon_serverW=84
   usri2_country_codeL=88
   usri2_code_pageL=92

   DllCall("netapi32\NetUserGetInfo", "uint",0, "uint",&sUserW, "uint",2, "uintp",pUsrInfo2)
   pUFN:=NumGet( 0+pUsrInfo2, usri2_full_nameW )

   L:=1+DllCall("lstrlenW","uint",pUFN)
   VarSetCapacity( sRet, L)
   dllCall("WideCharToMultiByte","uint",0, "uint",0, "uint",pUFN
              , "int",-1, "str",sRet, "uint",L, "uint",0, "uint",0)
   return sRet
}
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ggirf14



Joined: 01 Nov 2005
Posts: 108
Location: Ottawa

PostPosted: Wed Jan 09, 2008 8:07 pm    Post subject: Reply with quote

Thank you!
This is what I needed. Very Happy Very Happy Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group