Jump to content
  • Advertisement
Sign in to follow this  
aftermath

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

This topic is 5043 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
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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!