Subclassing Common Dialog Boxes Other Than Open and Save As

The previous material covered subclassing the Explorer-style Open and Save As common dialog boxes. This section covers subclassing all other types of common dialog boxes. The techniques in this section pertain to these common dialogs:

Color
Font
Print
Print Property Sheet (Win2000)
Page Setup
Find
Replace

The Dialog Template Resource

The foremost difference between the Open and Save As common dialogs and the remaining common dialogs is how the dialog template resource is created. With the Open and Save As common dialogs, a separate child dialog had to be created and integrated into the parent common dialog box. This is necessary because the dialog resource for these two common dialogs is embedded in the comdlg32.dll. Not so with these other common dialog boxes. Their dialog resources are available in C++ header files (*.h) and in resource (*.dlg) files. The header files contain all the control IDs for each control on these dialogs. The resource files contain the actual dialog resource. Table 5-7 lists all resource IDs, header files, and resource files that each common dialog box uses. These files are shipped with the Visual C++ development environment.

Table 5-7. Resource IDs, Header Files, and Resource Files of the Common Dialog Boxes

Dialog type

Resource ID

Resource File

Header File

Color

DLG_COLOR

Color.dlg

ColorDlg.h

Font

FORMATDLGORD31

Font.dlg

Dlgs.h

Print

PRINTDLGORD

Prnsetup.dlg ...

Get Subclassing and Hooking with Visual Basic now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.