msgs12.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WM_QUIT (1.2)
                                                      Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINMESSAGEMGR
 
WM_QUIT
 
The WM_QUIT message is posted to terminate an application. The WinGetMsg
function returns FALSE when it receives this message. A message-processing
loop should terminate when WinGetMsg returns FALSE. For more information,
see the description of the WinGetMsg function.
 
This message does not have any parameters.
 
Return Value
 
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.
 
Example
 
In this example, a WM_CLOSE message is received. If the fChanges flag is
set, the application calls a function to determine if the user wants to save
the changes before exiting. This function (called QuerySaveFile in this
example) would ask the user if he or she wants to save the changes. If the
user selects OK, it would save the changes. If the user selects Cancel, the
function returns this value and the application continues normal execution.
Otherwise, it posts a WM_QUIT message to terminate the application.
 
case WM_CLOSE:
    if (fChanges) {             /* changes have not been saved */
        if (QuerySaveFile(hwnd) == MB_CANCEL) {
            return (0L);        /* do not exit after all       */
        }
    }
    WinPostMsg(hwnd, WM_QUIT, 0L, 0L);
    return (0L);
 
See Also
 
WinGetMsg, WinPostMsg