7 out of 9 rated this helpful - Rate this topic

WM_QUIT message

Applies to: desktop apps only

Indicates a request to terminate an application, and is generated when the application calls the PostQuitMessage function. This message causes the GetMessage function to return zero.

#define WM_QUIT                         0x0012

Parameters

wParam

The exit code given in the PostQuitMessage function.

lParam

This parameter is not used.

Return value

Type: LRESULT

This message does not have a return value because it causes the message loop to terminate before the message is sent to the application's window procedure.

Remarks

The WM_QUIT message is not associated with a window and therefore will never be received through a window's window procedure. It is retrieved only by the GetMessage or PeekMessage functions.

Do not post the WM_QUIT message using the PostMessage function; use PostQuitMessage.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

See also

Reference
GetMessage
PeekMessage
PostQuitMessage
Conceptual
Windows

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
WM_QUIT behavior

Note: WM_QUIT is not a real message. PostQuitMessage sets a flag on the message queue to indicate that a quit is pending. GetMessage tests the flag after all messages queued by PostMessage are no longer pending in the message queue. If the flag is set, GetMessage returns zero.

PeekMessage(WM_QUIT) behaves similarly, reporting WM_QUIT is not found if other queued messages are pending.

Value
WM_QUIT = &H12