BOOL EndDialog(hwndDlg, nResult) | |||||
HWND hwndDlg; | /* handle of dialog box | */ | |||
int nResult; | /* value to return | */ |
This function terminates a modal dialog box and returns the given result to the DialogBox function that created the dialog box. The EndDialog function is required to complete processing whenever the DialogBox function is used to create a modal dialog box. The function must be used in the dialog function of the modal dialog box and should not be used for any other purpose.
The dialog function can call EndDialog at any time, even during the processing of the WM_INITDIALOG message. If called during the WM_INITDIALOG message, the dialog box is terminated before it is shown or before the keyboard focus is set.
EndDialog does not terminate the dialog box immediately. Instead, it sets a flag that directs the dialog box to terminate as soon as the dialog function ends. The EndDialog function returns to the dialog function, so the dialog function must return control to Windows.
hwndDlg
Identifies the dialog box to be destroyed.
nResult
Specifies the value to be returned from the dialog box to the DialogBox function that created it.
Returns TRUE for success, FALSE for failure.
DialogBox