ExitWindows macro (winuser.h)

Calls the ExitWindowsEx function to log off the interactive user. Applications should call ExitWindowsEx directly.

Syntax

void ExitWindows(
   dwReserved,
   Code
);

Parameters

dwReserved

This parameter must be zero.

Code

This parameter must be zero.

Return value

None

Remarks

The system sends a WM_QUERYENDSESSION to the main window of each running application.

An application agrees to terminate by returning TRUE when it receives this message (or by allowing the DefWindowProc function to process the message). If any application returns FALSE when it receives the WM_QUERYENDSESSION message, the logoff is canceled.

After the system processes the results of the WM_QUERYENDSESSION message, it sends the WM_ENDSESSION message with the wParam parameter set to TRUE if the system is shutting down and to FALSE if it is not.

Examples

For an example, see How to Log Off the Current User.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header winuser.h (include Windows.h)

See also

DefWindowProc

ExitWindowsEx

Logging Off

System Shutdown Functions