PostQuitMessage function (winuser.h)

Indicates to the system that a thread has made a request to terminate (quit). It is typically used in response to a WM_DESTROY message.

Syntax

void PostQuitMessage(
  [in] int nExitCode
);

Parameters

[in] nExitCode

Type: int

The application exit code. This value is used as the wParam parameter of the WM_QUIT message.

Return value

None

Remarks

The PostQuitMessage function posts a WM_QUIT message to the thread's message queue and returns immediately; the function simply indicates to the system that the thread is requesting to quit at some time in the future.

When the thread retrieves the WM_QUIT message from its message queue, it should exit its message loop and return control to the system. The exit value returned to the system must be the wParam parameter of the WM_QUIT message.

Examples

For an example, see Posting a Message.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows 8)

See also

Conceptual

GetMessage

Messages and Message Queues

PeekMessage

PostMessage

Reference

WM_DESTROY

WM_QUIT