How to Log Off the Current User
Applications can use the ExitWindows
function to log off the current user.
By default, when an application uses ExitWindows
to log off, the system sends the WM_QUERYENDSESSION
message to each window. Applications agree to terminate by returning TRUE
when they receive this message. If any application returns FALSE, the log-off
operation is canceled.
When an application returns TRUE for this message, it receives the
WM_ENDSESSION message and it is terminated, regardless of how the other applications
respond to the WM_QUERYENDSESSION message.
After all applications return TRUE for this message, they receive the
WM_ENDSESSION and they are terminated.
To force all application to terminate, use ExitWindowsEx
, and specify the EXW_FORCE flag. This prevents the system from sending
The system also sends the CTRL_LOGOFF_EVENT control signal to every process
during a log-off operation. A console application can register a HandlerRoutine
to process these messages.
- Software for developers
Software for Android Developers
- More information resources
Unix Manual Pages
- Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database