Customizing the Print Property Sheet
[This is preliminary documentation and subject to change.]
You can customize the Print property sheet in the following ways:
-
Provide a custom template for the lower portion of the General page. This allows you to include additional controls that are unique to your application. The PrintDlgEx function uses your custom template in place of the default template.
-
Provide additional property pages to follow the General page.
-
Provide a callback object. For more information, see Callback Object for the Print Property Sheet.
You cannot change the upper portion of the General page. You cannot change property pages provided by the printer driver.
To provide a custom template for the General page
-
Create a custom template for the lower portion of the General page by modifying the PRINTDLGEXORD template specified in the PRNSETUP.DLG file. The custom template must be the same size as the default template. The control identifiers used in the default Print dialog template are defined in the DLGS.H file.
-
Use the PRINTDLGEX structure to enable the template as follows:
-
If your custom template is a resource in an application or dynamic-link library, set the PD_ENABLEPRINTTEMPLATE flag in the Flags member. Use the hInstance and lpPrintTemplateName members of the structure to identify the module and resource name.
-Or-
-
If your custom template is already in memory, set the PD_ENABLEPRINTTEMPLATEHANDLE flag. Use the hInstance member to identify the memory object that contains the template.
-
If you use a custom template to define additional controls, you must provide a callback object to process input for your controls. The callback object implements a IPrintDialogCallback::HandleMessage method which receives messages sent to the custom dialog box.
To provide additional property pages
-
Use the CreatePropertySheetPage function to create the additional pages.
-
Use the lphPropertyPages member of the PRINTDLGEX structure to specify an array of handles to the additional pages.
The dialog box procedures specified when you created each page process messages sent to the pages.
-
You might want to provide a callback object that implements the IObjectWithSite interface. The PrintDlgEx function uses this interface to pass to the application a pointer to an IPrintDialogServices interface. The dialog box procedures for the additional property pages can use this interface to retrieve information about the currently selected printer.