The DLGTEMPLATEEX structure is not defined in any standard header file. The structure definition is provided here to explain the format of an extended template for a dialog box.
An extended dialog box template begins with a DLGTEMPLATEEX header that describes the dialog box and specifies the number of controls in the dialog box. For each control in a dialog box, an extended dialog box template has a block of data that uses the DLGITEMTEMPLATEEX format to describe the control.
// typedef struct { // WORD dlgVer; // WORD signature; // DWORD helpID; // DWORD exStyle; // DWORD style; // WORD cDlgItems; // short x; // short y; // short cx; // short cy; // sz_Or_Ord menu; // name or ordinal of a menu resource // sz_Or_Ord windowClass; // name or ordinal of a window class // WCHAR title[titleLen]; // title string of the dialog box // short pointsize; // only if DS_SETFONT flag is set // short weight; // only if DS_SETFONT flag is set // short bItalic; // only if DS_SETFONT flag is set // WCHAR font[fontLen]; // typeface name, if DS_SETFONT is set // } DLGTEMPLATEEX;
Value |
Meaning |
DS_3DLOOK |
Gives the dialog box a nonbold font and draws three-dimensional borders around control windows in the dialog box. The DS_3DLOOK style is required only by Win32-based applications compiled for versions of Windows earlier than Windows 95 or Windows NT 4.0. The system automatically applies the three-dimensional look to dialog boxes created by applications compiled for current versions of Windows. |
DS_ABSALIGN |
Indicates that the coordinates of the dialog box are screen coordinates. If this style is not specified, the system treats them as client coordinates. |
DS_CENTER |
Centers the dialog box in the working area; that is, the area not obscured by the tray. |
DS_CENTERMOUSE |
Centers the mouse cursor in the dialog box. |
DS_CONTEXTHELP |
Includes a question mark in the title bar of the dialog box. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message. The control should pass the message to the dialog procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the control. Note that DS_CONTEXTHELP is only a placeholder. When the dialog box is created, the system checks for DS_CONTEXTHELP and, if it is there, adds WS_EX_CONTEXTHELP to the extended style of the dialog box. You cannot use the WS_EX_CONTEXTHELP style with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles. |
DS_CONTROL |
Creates a dialog box that works well as a child window of another dialog box, much like a page in a property sheet. This style allows the user to tab among the control windows of a child dialog box, use its accelerator keys, and so on. |
DS_FIXEDSYS |
Causes the dialog box to use the SYSTEM_FIXED_FONT instead of the default SYSTEM_FONT. SYSTEM_FIXED_FONT is a monospace font compatible with the System font in Windows versions earlier than 3.0. |
DS_LOCALEDIT |
Applies to 16-bit applications only. This style directs edit controls in the dialog box to allocate memory from the application’s data segment. Otherwise, edit controls allocate storage from a global memory object. |
DS_MODALFRAME |
Creates a dialog box with a modal dialog-box frame that can be combined with a title bar and System menu by specifying the WS_CAPTION and WS_SYSMENU styles. |
DS_NOFAILCREATE |
Windows 95 only: Creates the dialog box even if errors occur ¾ for example, if a child window cannot be created or if the system cannot create a special data segment for an edit control. |
DS_NOIDLEMSG |
Suppresses WM_ENTERIDLE messages that Windows would otherwise send to the owner of the dialog box while the dialog box is displayed. |
DS_SETFONT |
Indicates that the DLGTEMPLATEEX header of the extended dialog box template contains four additional members (pointsize, weight, bItalic, and font) that describe the font to use for the text in the client area and controls of the dialog box. If possible, the system creates a font according to the values specified in these members. Then the system passes the handle of the font to the dialog box and to each control by sending them the WM_SETFONT message. If this style is not specified, the extended dialog box template does not include the pointsize, weight, bItalic, and font members. |
DS_SETFOREGROUND |
Causes the system to use the SetForegroundWindow function to bring the dialog box to the foreground. |
DS_SYSMODAL |
Creates a system-modal dialog box. This style causes the dialog box to have the WS_EX_TOPMOST style. Otherwise, it has no effect on the dialog box or the behavior of other windows in the system when the dialog box is displayed. |
You can use an extended dialog box template instead of a standard dialog box template in the CreateDialogIndirectParam and DialogBoxIndirectParam functions and the CreateDialogIndirect and DialogBoxIndirect macros. A standard dialog box template uses the DLGTEMPLATE and DLGITEMTEMPLATE structures.
Following the DLGTEMPLATEEX header in an extended dialog box template is one or more DLGITEMTEMPLATEEX structures that describe the controls of the dialog box. The cDlgItems member specifies the number of DLGITEMTEMPLATEEX structures in the template.
Each DLGITEMTEMPLATEEX structure in the template must be aligned on a DWORD boundary. If the style member specifies the DS_SETFONT style, the first DLGITEMTEMPLATEEX structure begins on the first DWORD boundary after the font string. If DS_SETFONT is not specified, the first structure begins on the first DWORD boundary after the title string.
The menu, windowClass, title, and font arrays must be aligned on WORD boundaries.
If you specify character strings in the menu, windowClass, title, and font arrays, you must use Unicode strings. To create code that works on both Windows NT and Windows 95, use the MultiByteToWideChar function to generate these Unicode strings.
The x, y, cx, and cy members specify values in dialog box units. You can convert these values to screen units (pixels) by using the MapDialogRect function.
CreateDialogIndirect, CreateDialogIndirectParam, DialogBoxIndirect, DialogBoxIndirectParam, DLGITEMTEMPLATE, DLGITEMTEMPLATEEX, DLGTEMPLATE, MapDialogRect, MultiByteToWideChar, WM_SETFONT