Use CPSUI with printer drivers
Important
The modern print platform is Windows' preferred means of communicating with printers. We recommend that you use Microsoft's IPP inbox class driver, along with Print Support Apps (PSA), to customize the print experience in Windows 10 and 11 for printer device development.
For more information, see Modern print platform and the Print support app design guide.
The print spooler, in conjunction with printer interface DLLs, uses CPSUI to create property sheet pages for print documents and printer devices. The following steps are involved when an application (such as Microsoft Word) displays a property sheet for a print document:
The application calls the print spooler's DocumentProperties function, specifying the printer on which the document is to be printed.
The print spooler calls CPSUI's entry point function, CommonPropertySheetUI, specifying an internal PFNPROPSHEETUI-typed callback function.
CPSUI calls the spooler's PFNPROPSHEETUI-typed callback function.
The spooler's PFNPROPSHEETUI-typed callback function calls CPSUI's ComPropSheet function (with a CPSFUNC_ADD_PFNPROPSHEETUI function code) to notify CPSUI of the address of the appropriate printer interface DLL's DrvDocumentPropertySheets function.
CPSUI calls the printer interface DLL's DrvDocumentPropertySheets function.
The printer interface DLL's DrvDocumentPropertySheets function calls CPSUI's ComPropSheet function (typically with a CPSFUNC_ADD_PCOMPROPSHEETUI function code) to provide CPSUI with property sheet page descriptions and page event callbacks.
CPSUI's ComPropSheet function calls CreatePropertySheetPage (described in the Windows SDK documentation) to create the property sheet pages specified by the printer interface DLL. CPSUI then calls PropertySheet to display the property sheet pages.
The following diagram illustrates these steps.
As the application user traverses the property sheet pages and modifies option values, the operating system notifies CPSUI of page events and CPSUI, in turn, calls the page event callback supplied by the printer interface DLL. The page event callback handles page events and stores newly selected option values internally, as necessary.
When the user dismisses the property sheet by clicking on the Ok or Cancel button, CPSUI destroys the pages and causes the CommonPropertySheetUI function to return to the print spooler, which then returns control to the application.
When an application displays a property sheet for a printer device instead of a print document, the same steps are followed, except that the application calls the spooler's PrinterProperties function and the spooler passes the address of the printer interface DLL's DrvDevicePropertySheets function to CPSUI.