Available for Window (non MDI child) and DialogBox objects.
EndModal Proto hWnd:HWND, lRetValue:LONG
Invoke EndModal, hWnd, lRetValue
Closes and destroys a modal window.
Handle to the modal window to be destroyed.
Value to be returned when the modal window is destroyed.
Eax returns TRUE if succesful, or FALSE if not.
REMARKS: When creating a modal window (see the Create method), its parent is disabled and has no control until the modal window is destroyed. At this point, we expect a return value to tell us whether the user validated or cancelled whatever inside the modal window. This value (usually IDOK or IDCANCEL) is returned in the Eax register when the Create method returns, and it is the value passed as the second argument (lRetValue) to the EndModal method.
IMPORTANT: If the handle passed as the first argument
(hWnd) is invalid or does not refer to a modal window, the return value is FALSE.