Modeless Dialog Boxes
A modeless dialog box should be a pop-up window having a System menu, a title
bar, and a thin border; that is, the dialog box template should specify the
WS_POPUP, WS_CAPTION, WS_BORDER, and WS_SYSMENU styles. Windows does
not automatically display the dialog box unless the template specifies the
WS_VISIBLE style.
An application creates a modeless dialog box by using the
CreateDialog or
CreateDialogIndirect function.
CreateDialog requires the name or identifier of a resource containing a dialog box
template;
CreateDialogIndirect requires the handle of a memory object containing a dialog box template. Two
other functions,
CreateDialogParam and
CreateDialogIndirectParam, also create modeless dialog boxes; they pass a specified parameter to the
dialog box procedure when the dialog box is created.
CreateDialog and other creation functions return a window handle for the dialog box. The
application and the dialog box procedure can use this handle to manage the
dialog box. For example, if WS_VISIBLE is not specified in the dialog box template,
the application can display the dialog box by passing the window handle to the
ShowWindow function.
A modeless dialog box neither disables the owner window nor sends messages to
it. When creating the dialog box, Windows makes it the active window, but the
user or the application can change the active window at any time. If the dialog
box does become inactive, it remains above the owner window in the Z order,
even if the owner window is active.
The application is responsible for retrieving and dispatching input messages
to the dialog box. Most applications use the main message loop for this. To
permit the user to move to and select controls by using the keyboard, however, the
application must call the
IsDialogMessage function. For more information about this function, see
Dialog Box Keyboard Interface.
A modeless dialog box cannot return a value to the application as a modal
dialog box does, but the dialog box procedure can send information to the owner
window by using the
SendMessage function.
An application must destroy all modeless dialog boxes before terminating. It
can destroy a modeless dialog box by using the
DestroyWindow function. In most cases, the dialog box procedure calls
DestroyWindow in response to user input, such as choosing the Cancel button. If the user
never closes the dialog box in this way, the application must call
DestroyWindow.
DestroyWindow invalidates the window handle for the dialog box, so any subsequent calls to
functions that use the handle return error values. To prevent errors, the
dialog box procedure should notify the owner that the dialog box has been destroyed.
Many applications maintain a global variable containing the handle for the
dialog box. When the dialog box procedure destroys the dialog box, it also sets
the global variable to NULL, indicating that the dialog box is no longer valid.
The dialog box procedure must not call the
EndDialog function to destroy a modeless dialog box.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database