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.
WinDismissDlg (1.2)
◄Function Group► ◄Overview► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
#define INCL_WINDIALOGS
BOOL WinDismissDlg(hwndDlg, usResult)
HWND hwndDlg; /* handle of the dialog */
USHORT usResult; /* result code to return */
The WinDismissDlg function hides the dialog window and causes the
WinProcessDlg or WinDlgBox function to return.
Parameter Description
────────────────────────────────────────────────────────────────────────────
hwndDlg Identifies the dialog window to be hidden.
usResult Specifies the value that is returned to the caller of
WinProcessDlg or WinDlgBox.
Return Value
The return value is TRUE if the function is successful or FALSE if an error
occurs.
Comments
This function is required to complete the processing of a modal dialog
window and is called from its dialog procedure.
The WinDismissDlg function is automatically called by the WinDefDlgProc
function upon receiving a WM_COMMAND message. The WinDefDlgProc function
will set usResult to the identifier of the control that generated the
WM_COMMAND message.
Note that this function can be called from a modeless dialog box, although
this is not necessary since there is no internal message-processing loop. If
the function is called, the dialog box window is hidden. The application
must destroy the dialog box window, if required.
Example
This example shows a typical dialog procedure that has both an OK and a
Cancel button. If the user selects the OK button, WinDismissDlg is called
with a result value of TRUE. If the user selects the Cancel button,
WinDismissDlg is called with a result value of FALSE.
case WM_COMMAND:
switch (SHORT1FROMMP(mp1)) {
case ID_ENTER: /* OK button selected */
WinDismissDlg(hwnd, TRUE);
return (0L);
case ID_CANCEL: /* Cancel button selected */
WinDismissDlg(hwnd, FALSE);
return (0L);
See Also
WinDlgBox, WinProcessDlg, WM_COMMAND, WM_INITDLG
♦