Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 350
  • Last Modified:

Query System for Current logged in user

I have a basic visual c++ 2005 console app and I need a way to query information from the computer on which the application is running that will return the username of the current user logged into windows. The machines will be running windows xp. I'm sure there is a system API for this, but I don't know which one.
0
inviser
Asked:
inviser
  • 2
1 Solution
 
AxterCommented:
Hi inviser,
> I'm sure there is a system API for this, but I don't know which one.

You can use GetUserName API function

David Maisonave (Axter)
Cheers!
0
 
AxterCommented:
Example:
char UserName[256];
DWORD Size=255;

if  (!GetUserName(UserName,&Size))
{
  printf("cannot get user name\n");
  return;
}
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now