Q:

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?

A:

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.

A:

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...

