Learning New IDs

In previous versions of Windows, identifiers for the various controls in common dialog boxes resided in a header file that you included directly in your application. In Windows 95, those identifiers are defined in COMCTL32.LIB. Figure 6-6 illustrates which identifiers belong to which controls. Notice that some identifiers are defined in lowercase letters.

Figure 6-6.

Identifiers for controls in the Open and Save As common dialog boxes.

If you are the type who prefers code to pictures, here's the template used for the new Open and Save As common dialog boxes:

NEWFILEOPENORD DIALOG DISCARDABLE 0, 0, 280, 164
STYLE DS_MODALFRAME | 4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_CONTEXTHELP | WS_CLIPCHILDREN
CAPTION "Open"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Look &in:",stc4,7,6,41,8,SS_NOTIFY
COMBOBOX cmb2,50,3,138,100,CBS_DROPDOWNLIST |
CBS_OWNERDRAWFIXED | CBS_HASSTRINGS |
WS_VSCROLL | WS_TABSTOP
LTEXT "",stc1,188,2,82,17,NOT WS_GROUP | NOT WS_VISIBLE
LISTBOX lst1,4,20,272,85,LBS_SORT | LBS_NOINTEGRALHEIGHT |
LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE
LTEXT "File &name:",stc3,5,112,36,8,SS_NOTIFY
EDITTEXT edt1,54,110,155,12,ES_AUTOHSCROLL
LTEXT "Files of &type:",stc2,5,128,46,8,SS_NOTIFY
COMBOBOX cmb1,54,126,155,53,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
CONTROL "Open as &read-only",chx1,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,54,145,74,10
DEFPUSHBUTTON "&Open",IDOK,222,110,50,14
PUSHBUTTON "Cancel",IDCANCEL,222,128,50,14
PUSHBUTTON "&Help",pshHelp,222,145,50,14
END

Customization Guidelines

You can customize any of the common dialog boxes. You might, for instance, want to hide some of the original controls, add a few new controls, or enlarge a dialog box. If your application subclasses controls in any of the common dialog boxes, the subclass must be done during the processing of the WM_INITDIALOG message in the application's hook function. This allows the application to receive the control-specific messages first.

In general, it's not a good idea to customize the common dialog boxes too severely. After all, one of their chief benefits is a look and feel consistent with the rest of the Windows 95 user interface. I'd suggest that you customize these dialog boxes only if necessary, leaving the original look intact as much as possible. Users won't be confused by small modifications, however, such as a change in the size of the dialog box or the addition of a new control or two.