I looked around a bit and I found the code for this, but it didn’t work ... maybe my google skills are not great, but my question is ...
Can someone point me in the right direction how to get the name of the user registered on the network and the domain from which they are part of C ++. I am expanding my windows application. I work in Visual Studio 2008
Link or code are welcome.
thank
[EDIT] I'm looking for something like this http://www.ehow.com/how_5169653_user-address-microsoft-visual-sharp.html
Maybe you should take a look at this Microsoft article .
Thank.
goths, :
TCHAR username[UNLEN + 1]; DWORD size = UNLEN + 1; GetUserName((TCHAR*)username, &size);
Visual Studio Express 2012 ( Windows 7).
Username in line:
void UserName(string *x){ char username[UNLEN + 1]; DWORD size = UNLEN + 1; GetUserName(username, &size); string transition(username);*x=transition;} //use this synthax in main : string username;UserName(&username);
PS: don't forget these libraries:
#include <windows.h> #include <Lmcons.h> #include <string>