Abdul Khaliq
Abdul Khaliq

Reputation: 2463

How to check that system is in Log off state?

I want to check that whether the system is in log off state or not in VC++, any ideas?

Upvotes: 3

Views: 2706

Answers (2)

Copas
Copas

Reputation: 5952

In AutoIt I always detect if the system is logged off by checking the active window handle if the system is logged of the active window handle will return 0x0000000. In AutoIt it would look something like...

If WinGetHandle("") == 0x00000000 Then MsgBox(0,"","We are logged out!")

Hope that helps...

Upvotes: 3

On Freund
On Freund

Reputation: 4436

  • You can get logon/logoff notifications using various mechanisms (SENS, SCM Notifications if your program is a service, Winlogon notification if you're on XP)
  • You can use WMI to enumerate active sessions.
  • You can use the WTS API to enumerate sessions and query session information.

Upvotes: 4

Related Questions