Use CPSUI with printer drivers

Important

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 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:

  1. The application calls the print spooler's DocumentProperties function, specifying the printer on which the document is to be printed.

  2. The print spooler calls CPSUI's entry point function, CommonPropertySheetUI, specifying an internal PFNPROPSHEETUI-typed callback function.

  3. CPSUI calls the spooler's PFNPROPSHEETUI-typed callback function.

  4. 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.

  5. CPSUI calls the printer interface DLL's DrvDocumentPropertySheets function.

  6. 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.

  7. 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.

diagram illustrating the modules involved in displaying a property sheet.

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.