4.4.1 Device Drivers and the Print Dialog Box

The Print dialog box differs from other common dialog boxes in that part of its dialog box procedure resides in COMMDLG.DLL and part in a printer driver. A printer driver is a program that configures a printer, converts graphics device interface (GDI) commands to low-level printer commands, and stores commands for a particular print job in a printer's queue.

A printer driver exports a function called ExtDeviceMode, which displays a dialog box and its controls. In previous versions of Windows, an application called the LoadLibrary function to load a device driver and the GetProcAddress function to obtain the address of the ExtDeviceMode function. This is no longer necessary with the Windows common dialog box interface. Instead of calling LoadLibrary and GetProcAddress, a Windows application can call a single function, PrintDlg, to display the Print dialog box and begin a print job. The code for PrintDlg resides in COMMDLG.DLL. The dialog box that appears when an application calls PrintDlg differs slightly from the dialog box that appears when the application calls directly into the device driver. The functionality is very similar in spite of the different appearance.