[Excerpt from resfmt.zip...] 4.3 Dialog Box Resources A dialog box is contained in a single resource and has a header and a portion repeated for each control in the dialog box. The header is as follows: [Resource header (type = 5)] struct DialogBoxHeader { DWORD lStyle; DWORD lExtendedStyle; // new for NT WORD NumberOfItems; WORD x; WORD y; WORD cx; WORD cy; [Name or Ordinal] MenuName; [Name or Ordinal] ClassName; WCHAR szCaption[]; WORD wPointSize; // Only here if FONT set for dialog WCHAR szFontName[]; // This too }; The item DWORD lStyle is a standard window style composed of flags found in WINDOWS.H. The default style for a dialog box is: WS_POPUP | WS_BORDER | WS_SYSMENU The lExtendedStyle DWORD is used to specify the extended window style flags. If an extended style is specified on the DIALOG statement, or with the other optional modifier statements, this DWORD is set to that value. The items marked `Name or Ordinal' are the same format used throughout the resource file (most notably in each resource header) to store a name or an ordinal ID. As before, if the first word is an 0xffff, the next two bytes contain an ordinal ID. Otherwise, the first 1 or more WORDS contain a double-null-terminated string. An empty string is represented by a single WORD zero in the first location. The WORD wPointSize and WCHAR szFontName entries are present if the FONT statement was included for the dialog box. This can be detected by checking the entry lStyle. if lStyle & DS_SETFONT (DS_SETFONT = 0x40), then these entries will be present. The data for each control starts on a DWORD boundary (which may require some padding from the previous control), and its format is as follows: struct ControlData { DWORD lStyle; DWORD lExtendedStyle; WORD x; WORD y; WORD cx; WORD cy; WORD wId; [Name or Ordinal] ClassId; [Name or Ordinal] Text; WORD nExtraStuff; }; As before, the item DWORD lStyle is a standard window style composed of the flags found in WINDOWS.H. The type of control is determined by the class. The class is either given by a zero-terminated string, or in the case of many common Windows classes, is given a one word code to save space and speed processing - in this case, the ordinal number will be a WORD in length, but only the lower byte will be used. Because UNICODE allows 0x8000 as a legal character, the ordinal classes are prefaced with a of 0xFFFF, similar to the ordinal Type and Name fields. The one byte classes are listed here: #define BUTTON 0x80 #define EDIT 0x81 #define STATIC 0x82 #define LISTBOX 0x83 #define SCROLLBAR 0x84 #define COMBOBOX 0x85 The lExtendedStyle DWORD is used to specify the extended style flags to be used for this control. The extended style flags are placed at the end of the CONTROL (or other control statements) statement following the coordinates The extra information at the end of the control data structure is currently not used, but is intended for extra information that may be needed for menu items in the future. Usually it is zero length. The various statements used in a dialog script are all mapped to these classes along with certain modifying styles. The values for these styles can be found in WINDOWS.H. All dialog controls have the default styles of WS_CHILD and WS_VISIBLE. A list of the default styles used to make the script statements follows: Statement Default Class Default Styles CONTROL None WS_CHILD | WS_VISIBLE LTEXT STATIC ES_LEFT RTEXT STATIC ES_RIGHT CTEXT STATIC ES_CENTER LISTBOX LISTBOX WS_BORDER | LBS_NOTIFY CHECKBOX BUTTON BS_CHECKBOX | WS_TABSTOP PUSHBUTTON BUTTON BS_PUSHBUTTON | WS_TABSTOP GROUPBOX BUTTON BS_GROUPBOX DEFPUSHBUTTON BUTTON BS_DEFPUSHBUTTON | WS_TABSTOP RADIOBUTTON BUTTON BS_RADIOBUTTON AUTOCHECKBOX BUTTON BS_AUTOCHECKBOX AUTO3STATE BUTTON BS_AUTO3STATE AUTORADIOBUTTON BUTTON BS_AUTORADIOBUTTON PUSHBOX BUTTON BS_PUSHBOX STATE3 BUTTON BS_3STATE EDITTEXT EDIT ES_LEFT | WS_BORDER | WS_TABSTOP COMBOBOX COMBOBOX None ICON STATIC SS_ICON SCROLLBAR SCROLLBAR None The control text is stored in the `Name or Ordinal' format described in detail above.