Reputation: 465
I modified my username in Control Panel -> User Accounts -> Change Your Name.
But when I use the GetUserName
function, it returned my old username.
How do I get the new one?
EDIT 1
Here's the code as requested:
char user[UNLEN + 1];
DWORD user_len = UNLEN + 1;
GetUserName(user, &user_len);
Upvotes: 1
Views: 1707
Reputation: 33272
Try to use the API GetUserNameEx, and passing as a format NameDisplay
. I guess you changed the display name of the user, not the logon name.
Upvotes: 5