I'm trying to get the username of the current user (not computer name). I'm also trying to do this OOP using classes and functions/methods, but it ain't working.
^Thanks!
I just had to add GetUserName() with GetUserNameA(); why is it working when I add an A?
And I've got another question as well, my code isn't working when I replace DWORD with unsigned int, however, DWORD is the same as a 32-bit unsigned int.
Most Windows API functions and structures involving strings are available in two versions:
a UTF-8 version eg. GetUserNameA(), CreateFileA() etc (xxxnameA)
and a UTF-16 version eg. GetUserNameW(), CreateFileW() etc (xxxnameW)
> my code isn't working when I replace DWORD with unsigned int,
> however, DWORD is the same as a 32-bit unsigned int.
IIRC, on most platforms, DWORD is a type alias for unsigned long.
In C++, unsigned int and unsigned long are two distinct types;
there is no implicit conversion from unsigned int* to unsigned long*