Creating the Subclassing Application

The application we will create in this section subclasses the Save As common dialog box. This application has one form module called frmMain.frm, which is displayed in Figure 5-7. The nondefault properties of this form are listed in Table 5-5. The form contains a command button control called Command1 and a text box control called Edit1.

The main form of the sample application

Figure 5-7. The main form of the sample application

Table 5-5. Nondefault Properties of frmMain and Its Controls

Control Name

Property Name

Property Value

frmMain

Caption

Ch5 - Common Dialog Subclassing Example

frmMain

BorderStyle

3-Fixed Dialog

frmMain

Top

0

frmMain

Left

0

frmMain

Height

3420

frmMain

Width

5760

Command1

Caption

Display Subclassed Dialog

Command1

Top

60

Command1

Left

60

Command1

Height

852

Command1

Width

1212

txtMsg

Multiline

True

txtMsg

Top

60

txtMsg

Left

1380

txtMsg

Height

2952

txtMsg

Width

4272

Clicking the button control creates a Save As common dialog box, subclasses it, and displays it. The Save As dialog is modified to include the extra controls that are contained in our resource DLL. This dialog is displayed in Figure 5-8.

The subclassed Save As common dialog box

Figure 5-8. The subclassed Save As common dialog box

The first thing you might notice about this new dialog is that ...

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.