Hello everybody, I'm trying to get the user name using GetUserName() API function, it was sucessful in the console project however in the Visual C++ project it gives me this error:
1>MyProgram.obj : error LNK2028: unresolved token (0A00000F) "extern "C" int __stdcall GetUserNameA(char *,unsigned long *)" (?GetUserNameA@@$$J18YGHPADPAK@Z) referenced in function "private: void __clrcall MyProgram::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@MyProgram@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>MyProgram.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall GetUserNameA(char *,unsigned long *)" (?GetUserNameA@@$$J18YGHPADPAK@Z) referenced in function "private: void __clrcall MyProgram::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@MyProgram@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
And I'm using this piece of code:
char LoginID[256];
DWORD buffer = 256;
GetUserName(LoginID, &buffer);
Any Help appreciated :).