Detecting Logoff from a ServiceID: Q151424
|
Sometimes it is handy for a service to determine whether or not a user is
logged on the system. For example, there are circumstances under which the
service displays a dialog box and waits for a user to respond. If this is
done when no user is logged on, the service is blocked until a user logs
on.
Services can be notified when a user logs off a system but not when a
user logs on. A service receives a notification from the system by
installing a Console Control handler. The handler receives a
CTRL_LOGOFF_EVENT when the interactive user logs off the system. For more
information on Console Control handlers, please refer to the Win32 SDK
Online Reference.
A service can determine whether an interactive user is logged on by
determining whether the process specified in the following key is running:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
\Winlogon
Additional query words: 3.50
Keywords : kbKernBase kbService kbGrpKernBase
Version : 3.50 3.51 4.00
Platform : NT WINDOWS
Issue type :
Last Reviewed: March 10, 1999