Liad
Liad

Reputation: 433

C++ check if any user is logged in to windows 7

I use psexec to run my app, Some of the tasks my app does should have a logged on user, so I want to check (from the app, not the server which runs the psexec) if there is a user which currently logged on. I couldn't find any api which retrieve this. My code is in c++. Any idea to check it?

Upvotes: 2

Views: 1606

Answers (2)

Liad
Liad

Reputation: 433

Found a solution to this issue I enumerate the registry keys (using RegEnumKeyEx) under HKEY_USERS. If there is a key different from the default ones (".DEFAULT","S-1-5-18","S-1-5-19","S-1-5-20") it means that at least on user is logged on

Upvotes: -1

Related Questions