## Printer Device Driver

[prev][next][parent][TOC]

### Dialog-Box Format

There are three C files that are used for the PostScript dialogs:

PPDLG.C contains code that maintains the Printer-Properties dialog box.
JPDLG.C contains code that maintains the Job-Properties dialog box.
DLG.C contains common code that is used by both properties.
Each page in the dialog's notebook is a separate dialog box, and each page handles data internally. There is a structure called the dialog header ( DLGHDR). The address of the dialog header is stored in the reserved doubleword of each dialog page.

Each page dialog must handle the following messages:

WMPS_INITSETTINGS This is sent to all dialog pages after the dialog header initializes. The WM_INITDLG message is sent before this message; at this time, the dialog header has not yet been initialized. A rule of thumb is that controls can be set up when the WM_INITDLG message is received. For example, spin buttons can be set to their minimum and maximum values. At the WMPS_INITSETTINGS message, the control is initialized with the values from the dialog header. Processing of this message is optional.

WMPS_VERIFYSETTINGS This indicates that the page dialog should verify that the settings within the page are valid. If all the control settings are valid, or if no verification is needed, the return code should be set to PSDRC_VERIFY_SUCCESS. If an invalid setting exists, the page should return another return code, which will cause the dialog to display a message indicating that an error exists. Processing of this message is required.

WMPS_SAVESETTINGS This indicates that the page dialog should save the settings within its controls. The page dialog must return PSDRC_SAVE_ SUCCESS to indicate that all was saved successfully. Processing of this message is required only if you wish to save any settings.

There is a structure called the "dialog template" (DLG_TMPL). This structure contains information that is used by the dialog functions at initialization. The DLG_TMPL structure is broken down as follows:

uiDialogID This contains the ID of the dialog to be inserted.

pfnDlgProc This contains the dialog procedure.

usTabID This contains a string ID. This is the string that is inserted in the page's tab.

chTabID This is reserved.

pfnQueryLoadFn This is optional. It contains a function to verify whether or not the page should be loaded. If the page should be inserted, the function should return TRUE; otherwise, the function should return FALSE. The only input argument is a PVOID to the dialog header. The function returns a BOOL value. Before inserting the "Features" page, for example, the dialog calls the function QueryFeaturePageLoad(). If there are enough features that warrant this page, the function returns TRUE. If no function is provided, the page is always loaded.