I want to be able to display the currently active user on my web page.
Right now I have this code snippet in my CGI program:
But the query function fails with the error code 5 (ERROR_ACCESS_DENIED). Does anyone know how to determine which user is currently active?Code:char* UserName; DWORD Size; WTSQuerySessionInformation( WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, &UserName, &Size); cout << "<tr bgcolor=\"#DBF7E2\"><td>"; cout << "Currently active user:</td><td>" << (GetLastError()==0?UserName:"<error>"); cout << "</td></tr>";
Note: GetUserName() won't work, it'll return the name of the user the webserver is running as.