Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Sent as a signal that a window or an application should terminate.
A window receives this message through its WindowProc function.
#define WM_CLOSE 0x0010
wParam
This parameter is not used.
lParam
This parameter is not used.
Type: LRESULT
If an application processes this message, it should return zero.
LRESULT CALLBACK WindowProc(
__in HWND hWindow,
__in UINT uMsg,
__in WPARAM wParam,
__in LPARAM lParam)
{
switch (uMsg)
{
case WM_CLOSE:
DestroyWindow(hWindow);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWindow, uMsg, wParam, lParam);
}
return 0;
}
Example from Windows Classic Samples on GitHub.
An application can prompt the user for confirmation, prior to destroying a window, by processing the WM_CLOSE message and calling the DestroyWindow function only if the user confirms the choice.
By default, the DefWindowProc function calls the DestroyWindow function to destroy the window.
Requirement | Value |
---|---|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
Minimum supported server |
Windows 2000 Server [desktop apps only] |
Header |
|
Reference
Conceptual
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!