EndModal method


Available for Window (non MDI child) and DialogBox objects.

Prototype

EndModal Proto hWnd:HWND, lRetValue:LONG

Syntax

Invoke EndModal, hWnd, lRetValue

Function

Closes and destroys a modal window.

Parameters

hWnd

Handle to the modal window to be destroyed.

lRetValue

Value to be returned when the modal window is destroyed.

Return value

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.