CommonPropertySheetUIA function

CPSUI's CommonPropertySheetUI function displays property sheet pages and allows user modifications to displayed values.


LONG CommonPropertySheetUIA(
  HWND           hWndOwner,
  LPARAM         lParam,
  LPDWORD        pResult



Caller-supplied window handle identifying the window into which new property sheet pages are to be placed.


Caller-supplied pointer to a PFNPROPSHEETUI-typed callback function.


Caller-supplied value that is used as an input argument to the pfnPropSheetUI function. This value can be a pointer.


Caller-supplied pointer to a DWORD that receives the pfnPropSheetUI function's final return status. If NULL, the final return status is not returned. For more information, see the following Remarks section.

Return Value

The CommonPropertySheetUI function returns one of the following values:

Return code Description
The pfnPropSheetUI function returned a negative value.
The operation succeeded.
The operation succeeded, and a dialog box procedure sent the PSM_REBOOTSYSTEM message (defined in the Microsoft Windows SDK documentation).
The operation succeeded, and a dialog box procedure sent the PSM_RESTARTWINDOWS message (defined in the Windows SDK documentation).
ERR_CPSUI-prefixed error code
A failure occurred. The ERR_CPSUI-prefixed error codes are defined in compstui.h.


The CommonPropertySheetUI function is CPSUI's entry point for applications. A CPSUI application (such as the Microsoft NT-based operating system print spooler) can call the function to add one or more property sheet pages to a predefined parent window. CPSUI displays the pages, allows the user to modify them, and notifies the application of user activity through callback functions.

The NT-based operating system print spooler calls the CommonPropertySheetUI function when a Win32 application calls the spooler's DocumentProperties or PrinterProperties functions, which are described in the Windows SDK documentation.

The callback function specified by the pfnPropSheetUI parameter is responsible for describing the property sheet pages to be added. For more information, see the description of the PFNPROPSHEETUI function type.

The sequence of operation is as follows:

  1. The CommonPropertySheetUI function calls the pfnPropSheetUI callback so the callback can describe the pages to be added by calling CPSUI's ComPropSheet function.
  2. If the pfnPropSheetUI callback succeeds, the CommonPropertySheetUI function displays the new property sheet pages and allows the user to modify page values.
  3. If the user modifies page values, a page event callback notifies the application of the changes.
  4. When the user chooses the OK or Cancel button, the CommonPropertySheetUI function destroys the displayed pages and returns.
For more information about the sequence of operation, see Using CPSUI with Printer Drivers, in the section entitled CPSUI.

The CommonPropertySheetUI function actually calls the pfnPropSheetUI callback several times, specifying different Reason member values in the callback's PROPSHEETUI_INFO structure. Each time the callback returns, it places a result status in the PROPSHEETUI_INFO structure's Result member. When the CommonPropertySheetUI function returns, it copies the final contents of Result into the location pointed to by pResult.


Target Platform Desktop
Header compstui.h (include Compstui.h)