• Advertisement
Sign in to follow this  

[Win32] Getting user name (in John Smith form, not jsmith)

This topic is 4826 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
What do you mean exactly? You can simply use a windows edit box and use GetDlgItemText to read the entered text.

Share this post


Link to post
Share on other sites
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?)

Share this post


Link to post
Share on other sites
Check out GetUserNameEx in the MSDN!


char name[256];
ULONG nSize = 256;

GetUserNameEx(NameDisplay , name, &nSize);


Hope that helps!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement