Application-Defined Dialog Boxes

An application-defined dialog box is a child window that you design to suit the needs of your application. You can use any kind of control in a dialog box and lay it out in any format you like.

    

Application-defined dialog box

In Windows CE, all dialog boxes are control parents. They are also recursive. This means that if a dialog box has a child dialog box when a user tabs through the parent dialog box , the dialog box manager tabs into the child dialog box as well. If a dialog box is outside the visible area of the screen, Windows CE does not automatically reposition it.

If a user presses alt+h while the dialog box has the input focus, the system posts a WM_HELP message to the dialog box procedure. Respond to this message by displaying context-sensitive Help for the dialog box.

Note Sometimes it is necessary for a dialog box to appear on top of all other windows. For example, under low memory conditions, the System Out of Memory Dialog Box will send a WM_CLOSE message to an application. If the application is not in the foreground, any dialog box it displays will be hidden behind the current foreground window unless you create the dialog box with the DS__SETFOREGROUND style. Because putting the dialog box in the foreground will not bring the application's main window forward, put in the dialog box any information that the user may need to decide what action to take.

In Windows CE, dialog boxes have the WS_POPUP style by default. If you want to use the WS_CHILD style instead, specify it in the style member of the DLGTEMPLATE structure you pass in the lpTemplate parameter to any of these functions. You can also specify the DS_CENTER or DS_SETFOREGROUND styles.

Dialog box styles supported by Windows CE are described in the following table.

Dialog box style Description
DS_ABSALIGN Indicates that the coordinates of the dialog box are screen coordinates. If this style is not specified, Windows CE assumes they are client coordinates.
DS_CENTER Centers the dialog box vertically and horizontally in the working area.
DS_MODALFRAME Creates a dialog box with a modal dialog-box frame that you can combine with a title bar and System menu by specifying the WS_CAPTION and WS_SYSMENU styles.
DS_SETFONT Indicates that the header of the dialog box template contains additional data specifying the font to use for text in the client area and the controls of the dialog box. The font data begins on the WORD boundary that follows the title array. It specifies a 16-bit point size value and a Unicode font name string. If possible, the system creates a font according to the specified values. The system then passes the handle of the font to the dialog box and to each control by sending them the WM_SETFONT message.
DS_SETFOREGROUND Brings the dialog box to the foreground.