[Win32] Getting user name (in John Smith form, not jsmith)
Like the title says, does anyone know what Win32 API functions I would use to get the current user name? I need it in formal format, like John Smith, as oposed to a user-id format like jsmith.
Thanks
What do you mean exactly? You can simply use a windows edit box and use GetDlgItemText to read the entered text.
Quote:Original post by tHiSiSbOb
What do you mean exactly? You can simply use a windows edit box and use GetDlgItemText to read the entered text.
He probably meant the Windows Register.
OP: Try doing a Google search on the Windows Register, where it's contained. (Somewhere along CURRENT_USER?)
Check out GetUserNameEx in the MSDN!
Hope that helps!
char name[256];ULONG nSize = 256;GetUserNameEx(NameDisplay , name, &nSize);
Hope that helps!
Windows registry.
Call NetUserGetInfo() with a level of 2 after you get the current username with GetUserName().
Special thanks: google groups.
That's for NT. For 9x you'll need a completely different way I'm afraid, look around. GetUserNameEx() is 2k up and only I think.
Call NetUserGetInfo() with a level of 2 after you get the current username with GetUserName().
Special thanks: google groups.
That's for NT. For 9x you'll need a completely different way I'm afraid, look around. GetUserNameEx() is 2k up and only I think.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement