WM CLOSE
This message is sent to a frame window to indicate that the window is being closed by the user.
Syntax
param1 ULONG ulReserved; /* Reserved value, should be 0. */ param2 ULONG ulReserved; /* Reserved value, should be 0. */
Parameters
- ulReserved (ULONG) - input
- Reserved value, should be 0.
- ulReserved (ULONG) - input
- Reserved value, should be 0.
Returns
- ulReserved (ULONG) - returns
- Reserved value, should be 0.
Remarks
This message is sent by the frame to itself as a result of receiving a WM_SYSCOMMAND message with SC_CLOSE code set. If this message is passed to WinDefDlgProc, this function calls WinDismissDlg and passes the DID_CANCEL result code to it.
in Frame Controls
Frame control sends this message to the client window (FID_CLIENT) if it exists, otherwise it calls the WinDefWindowProc function.
Default Processing
The default window procedure posts a WM_QUIT message to the appropriate queue and sets ulReserved to 0.
in Default Dialogs
The default dialog procedure responds to this message by dismissing the dialog by issuing the WinDismissDlg function with its parameter set to DID_CANCEL.
in Frame Controls
The default window procedure posts a WM_QUIT message to the appropriate queue and sets ulReserved to 0.
Example Code
This example checks the `fChanges` variable. If it is TRUE, the user is asked if he wants to exit without saving any changes. If the user responds by choosing the No button, zero is returned and the application does not exit. If the user responds by choosing the Yes button, a WM_QUIT message is posted and the application terminates.
case WM_CLOSE: if (fChanges) { if (WinMessageBox(HWND_DESKTOP, hwndClient, "Do you want to exit without saving your changes?", "", 0, MB_NOICON | MB_YESNO) == MBID_NO) return (0L); } WinPostMsg(hwnd, WM_QUIT, 0L, 0L); return (0L);
Related Messages
- WM_CLOSE (Default Dialogs)
- WM_CLOSE (in Frame Controls)