Nuja, was soll ich groß sagen?
Code:
#define INFO_BUFFER_SIZE 32767
struct dataBuf
{
TCHAR ComputerName[INFO_BUFFER_SIZE];
TCHAR UserName[INFO_BUFFER_SIZE];
TCHAR SysDir[INFO_BUFFER_SIZE];
TCHAR WinDir[INFO_BUFFER_SIZE];
};
...
dataBuf pData;
DWORD countChar = INFO_BUFFER_SIZE;
if( !GetUserName(pData.UserName, &countChar) )
{
cout << GetLastError() << endl;
}
...
cout << "user name: " << string(pData.UserName) << endl;
Hab praktisch das selbe wie bei
msdn (wo du zitiert hast
), nur z.T. andere Namen.
air