Finding User names.....
Hi, I was wondering if there is a way in c++ to find the user name of of someone who has logged onto a computer. I'm basically wondering if it is stored as a text document somewhere on the local drive, user drive or on the main hard disk.... I'm using windows XP pro if that helps. Cheers, twomers
If you're talking about the username (like the one ontop of the Start Menu on XP) then yes there is a way to get that. The function is most likely in windows.h, I don't know it off the top of my head.
If you want to know the username of the current windows user, call GetUserName.
You will need to include "Windows.h" and maybe link to the lib specified in the link.
DWORD dwLength = 500;
GetUserName( tszName, &dwLength );
printf( "%s", tszName );