共用方式為


DLGTEMPLATEEX

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This 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.

Syntax

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; 
  sz_Or_Ord windowClass; 
  WCHAR title[titleLen]; 
  short pointsize; 
  short weight; 
  short bItalic; 
  WCHAR font[fontLen];
} DLGTEMPLATEEX; 

Members

  • dlgVer
    Specifies the version number of the extended dialog box template. This member must specify 1.
  • signature
    Indicates whether a template is an extended dialog box template. A value of 0xFFFF indicates an extended dialog box template. In this case, the dlgVer member specifies the template version number. If signature is any value other than 0xFFFF, this is a standard template that uses the DLGTEMPLATE and DLGITEMTEMPLATE structures.
  • helpID
    Specifies the help context identifier for the dialog box window.
  • exStyle
    Specifies extended styles for a window. This member is not used to create dialog boxes, but applications that use dialog box templates can use it to create other types of windows.
  • style
    Specifies the style of the dialog box. This member can be a combination of window style values (such as WS_CAPTION) and one or more of the dialog box style values shown in the following table.

    Value Description

    DS_3DLOOK

    Gives the dialog box a nonbold font and draws three-dimensional borders around control windows in the dialog box.

    DS_CENTER

    Centers the dialog box in the working area; that is, the area not obscured by the tray.

    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_MODALFRAME

    Creates a dialog box with a modal dialog-box frame that can be combined with a title bar and window menu by specifying the WS_CAPTION and WS_SYSMENU styles.

    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.

  • cDlgItems
    Specifies the number of controls in the dialog box.
  • x
    Specifies the x-coordinate, in dialog box units, of the upper-left corner of the dialog box.
  • y
    Specifies the y-coordinate, in dialog box units, of the upper-left corner of the dialog box.
  • cx
    Specifies the width, in dialog box units, of the dialog box.
  • cy
    Specifies the height, in dialog box units, of the dialog box.
  • menu
    Not supported.
  • windowClass
    Specifies a variable-length array of 16-bit elements that identifies the window class of the dialog box. If the first element of the array is 0x0000, the system uses the predefined dialog box class for the dialog box and the array has no other elements. If the first element is 0xFFFF, the array has one additional element that specifies the ordinal value of a predefined system window class. If the first element has any other value, the system treats the array as a null-terminated Unicode string that specifies the name of a registered window class.
  • title
    Specifies a null-terminated Unicode string that contains the title of the dialog box. If the first element of this array is 0x0000, the dialog box has no title and the array has no other elements.
  • pointsize
    Specifies the point size of the font to use for the text in the dialog box and its controls. The pointsize, weight, bItalic, and font members are present in an extended dialog box template only if the style member specifies the DS_SETFONT style.
  • weight
    Specifies the weight of the font in the range 0 through 1000. This can be any of the values listed for the lfWeight member of the LOGFONT structure. This member is present only if the style member specifies DS_SETFONT.
  • bItalic
    Indicates whether the font is italic. If this value is TRUE, the font is italic. This member is present only if the style member specifies DS_SETFONT.
  • font
    Specifies a null-terminated Unicode string that contains the name of the typeface for the font. This member is present only if the style member specifies DS_SETFONT.

Remarks

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 windowClass, title, and font arrays, you must use Unicode strings. 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.

The following dwStyle flags are not supported for dialog boxes:

  • DS_ABSALIGN
  • DS_CENTERMOUSE
  • DS_CONTEXTHELP
  • DS_FIXEDSYS
  • DS_NOFAILCREATE
  • DS_NOIDLEMSG
  • DS_SYSMODAL

Windows Embedded CE does not support the addition of menus to a dialog box.

Requirements

Header winuser.h
Windows Embedded CE Windows CE 2.12 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

CreateDialogIndirect
CreateDialogIndirectParam
DialogBoxIndirect
DialogBoxIndirectParam
MapDialogRect
WM_SETFONT
DLGITEMTEMPLATE
DLGITEMTEMPLATEEX
DLGTEMPLATE
Dialog Boxes Structures

Other Resources

MultiByteToWideChar
LOGFONT