PFNCOMPROPSHEET - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// compstui.h

PFNCOMPROPSHEET Pfncompropsheet;

LONG_PTR Pfncompropsheet(
  [in] HANDLE hComPropSheet,
  [in] UINT Function,
  [in] LPARAM lParam1,
  [in] LPARAM lParam2
)
{...}
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nc-compstui-pfncompropsheet)

Description

The ComPropSheet function is supplied by CPSUI and can be called by CPSUI applications (including printer interface DLLs) to build property sheet pages.

Parameters

hComPropSheet [in]

Caller-supplied handle to a property sheet group parent. For more information, see the following Remarks section.

Function [in]

Caller-supplied, CPSFUNC_-prefixed ComPropSheet function codes specifying the operation to be performed by the ComPropSheet function. See the ComPropSheet function codes table in the Remarks section below.

lParam1 [in]

Caller-supplied value that depends on the ComPropSheet function code supplied for Function.

lParam2 [in]

Caller-supplied value that depends on the ComPropSheet function code supplied for Function.

Return value

The return value depends on the ComPropSheet function code supplied for Function.

Remarks

When CPSUI calls one of an application's PFNPROPSHEETUI-typed functions, it passes a pointer to the ComPropSheet function in a PROPSHEETUI_INFO structure. A PFNPROPSHEETUI-typed function can call the ComPropSheet function to describe property sheet pages to CPSUI.

A printer interface DLL can call ComPropSheet from within its DrvDocumentPropertySheets function or its DrvDevicePropertySheets function.

User interface plug-ins for Microsoft's Unidrv and Pscript drivers can call ComPropSheet from within their IPrintOemUI::DocumentPropertySheets and IPrintOemUI::DevicePropertySheets methods.

The group parent handle specified for the hComPropSheet parameter can be either of the following:

ComPropSheet function codes

The following function codes can be passed to the CPSUI's ComPropSheet function:

CPSFUNC_ADD_HPROPSHEETPAGE

The CPSFUNC_ADD_HPROPSHEETPAGE function code causes the ComPropSheet function to add a property sheet page that has been created by calling the CreatePropertySheetPage function.

Parameters (CPSFUNC_ADD_HPROPSHEETPAGE)
Return value (CPSFUNC_ADD_HPROPSHEETPAGE)

If the operation succeeds, ComPropSheet returns a CPSUI handle to the added page; otherwise, it returns NULL.

CPSFUNC_ADD_PCOMPROPSHEETUI

The CPSFUNC_ADD_PCOMPROPSHEETUI function code causes the ComPropSheet function to add a set of one or more property sheet pages that are described by a COMPROPSHEETUI structure.

Parameters
Return value

If the operation succeeds, ComPropSheet returns a handle to the set of added pages; otherwise, the function returns NULL.

CPSFUNC_ADD_PFNPROPSHEETUI

The CPSFUNC_ADD_PFNPROPSHEETUI function code causes the ComPropSheet function to call the specified PFNPROPSHEETUI-typed function, which must add a set of one or more property sheet pages.

Parameters (CPSFUNC_ADD_PFNPROPSHEETUI)
Return value (CPSFUNC_ADD_PFNPROPSHEETUI)

If the operation succeeds, ComPropSheet returns a handle to the set of added pages; otherwise, the function returns NULL.

CPSFUNC_ADD_PROPSHEETPAGE

The CPSFUNC_ADD_PROPSHEETPAGE function code causes the ComPropSheet function to add the type of property sheet page that is described by a PROPSHEETPAGE structure.

Parameters (CPSFUNC_ADD_PROPSHEETPAGE)
Return value (CPSFUNC_ADD_PROPSHEETPAGE)

If the operation succeeds, ComPropSheet returns a CPSUI handle to the added page; otherwise, it returns NULL.

CPSFUNC_DELETE_HCOMPROPSHEET

The CPSFUNC_DELETE_HCOMPROPSHEET function code causes the ComPropSheet function to delete a set of property sheet pages that are specified by a CPSUI handle.

Parameters (CPSFUNC_DELETE_HCOMPROPSHEET)
Return value (CPSFUNC_DELETE_HCOMPROPSHEET)

The ComPropSheet function returns the number of property sheet pages that were deleted.

CPSFUNC_DO_APPLY_CPSUI

The CPSFUNC_DO_APPLY_CPSUI function code causes the ComPropSheet function to simulate the delivery of a PSN_APPLY notification message.

CPSUI responds to the CPSFUNC_DO_APPLY_CPSUI function code by delivering the CPSUICB_REASON_APPLYNOW reason to an application's _CPSUICALLBACK-typed callback function.

Parameters (CPSFUNC_DO_APPLY_CPSUI)
Return value (CPSFUNC_DO_APPLY_CPSUI)

If the operation succeeds, the ComPropSheet function returns a nonzero value; otherwise it returns zero and the specified pages will become active.

If you use the CPSFUNC_IGNORE_CPSUI_PSN_APPLY function code to disable CPSUI's handling of the PSN_APPLY notification message, you must use the CPSFUNC_DO_APPLY_CPSUI function code to simulate delivery of the PSN_APPLY message. Otherwise, user changes to a property sheet page cannot be obtained.

CPSFUNC_GET_HPSUIPAGES

The CPSFUNC_GET_HPSUIPAGES function code causes the ComPropSheet function to return an array of CPSUI handles that point to property sheet pages. These handles identify the child pages associated with the specified group parent handle.

To use this function code, follow these steps:

Parameters (CPSFUNC_GET_HPSUIPAGES)
Return value (CPSFUNC_GET_HPSUIPAGES)

The ComPropSheet function returns the number of handles that CPSUI places into the HANDLE array.

CPSFUNC_GET_PAGECOUNT

The CPSFUNC_GET_PAGECOUNT function code causes the ComPropSheet function to return the number of property sheet pages that are child pages of the specified group parent handle.

Parameters (CPSFUNC_GET_PAGECOUNT)
Return value (CPSFUNC_GET_PAGECOUNT)

The ComPropSheet function returns the number of pages counted.

CPSFUNC_GET_PFNPROPSHEETUI_ICON

The CPSFUNC_GET_PFNPROPSHEETUI_ICON function code causes the ComPropSheet function to return a handle to the icon that is associated with a set of property sheet pages. The set of pages must have been previously created by a PFNPROPSHEETUI-typed function.

The ComPropSheet function calls the PFNPROPSHEETUI-typed function associated with the specified page handle, and passes a reason value of PROPSHEETUI_REASON_GET_ICON. The PFNPROPSHEETUI-typed function then calls LoadImage and provides the icon size specified bylParam2 to load an icon resource.

Parameters (CPSFUNC_GET_PFNPROPSHEETUI_ICON)
Return value (CPSFUNC_GET_PFNPROPSHEETUI_ICON)

If the operation succeeds, the ComPropSheet function returns an icon handle; otherwise it returns NULL.

CPSFUNC_IGNORE_CPSUI_PSN_APPLY

The CPSFUNC_IGNORE_CPSUI_PSN_APPLY function code causes the ComPropSheet function to disable or reenable CPSUI's handling of the PSN_APPLY notification message.

The system sends the PSN_APPLY notification message to CPSUI when a user selects a property sheet's OK or Cancel button. CPSUI responds to this message by delivering the CPSUICB_REASON_APPLYNOW reason to an application's _CPSUICALLBACK-typed callback function.

If you disable CPSUI's handling of the PSN_APPLY notification message, you must use the CPSFUNC_DO_APPLY_CPSUI function code to simulate delivery of the PSN_APPLY message. Otherwise, user changes to a property sheet page cannot be obtained.

If the CPSFUNC_IGNORE_CPSUI_PSN_APPLY function code is not used, CPSUI's handling of the PSN_APPLY notification message is enabled by default.

Parameters (CPSFUNC_IGNORE_CPSUI_PSN_APPLY)
Return value (CPSFUNC_IGNORE_CPSUI_PSN_APPLY)

If the operation succeeds, the ComPropSheet function returns a nonzero value; otherwise it returns zero.

CPSFUNC_INSERT_PSUIPAGE

The CPSFUNC_INSERT_PSUIPAGE function code causes the ComPropSheet function to insert a set of property sheet pages at a specific position.

Parameters (CPSFUNC_INSERT_PSUIPAGE)
Return value (CPSFUNC_INSERT_PSUIPAGE)

If the operation succeeds, the ComPropSheet function returns a handle to the set of pages that were inserted; otherwise, the function returns NULL.

CPSFUNC_LOAD_CPSUI_ICON

The CPSFUNC_LOAD_CPSUI_ICON function code causes the ComPropSheet function to load a CPSUI-supplied icon resource.

CPSUI calls LoadImage to load the specified icon resource.

Parameters (CPSFUNC_LOAD_CPSUI_ICON)
Return value (CPSFUNC_LOAD_CPSUI_ICON)

If the operation succeeds, the ComPropSheet function returns an icon handle; otherwise it returns NULL.

CPSFUNC_LOAD_CPSUI_STRING

The CPSFUNC_LOAD_CPSUI_STRING function code causes the ComPropSheet function to load a CPSUI-supplied string resource.

The ComPropSheet function calls the LoadString function to load the specified string.

Parameters (CPSFUNC_LOAD_CPSUI_STRING)
Return value (CPSFUNC_LOAD_CPSUI_STRING)

If the operation succeeds, the ComPropSheet function returns the length of the string. If an invalid resource identifier is specified, the function returns zero. If lParam1 is NULL or LOWORD(lParam2) is zero, the function returns -1.

CPSFUNC_QUERY_DATABLOCK

The CPSFUNC_QUERY_DATABLOCK function code causes the ComPropSheet function to retrieve a caller-supplied data block that was previously stored using the CPSFUNC_SET_DATABLOCK function code.

Typically, this function code is used by a _CPSUICALLBACK-typed callback function (when the function's CPSUICBPARAM structure contains a Reason value of CPSUICB_REASON_SETACTIVE) to retrieve values associated with another page before the current page becomes inactive.

Parameters (CPSFUNC_QUERY_DATABLOCK)
Return value (CPSFUNC_QUERY_DATABLOCK)

If the operation succeeds, the ComPropSheet function returns a value that represents the size of the retrieved data block. If lParam1 is NULL, or if the value of any member of the supplied CPSUIDATABLOCK structure is zero, ComPropSheet returns the size required to store the data block. If an error occurs, the function returns a value less than or equal to zero.

CPSFUNC_SET_DATABLOCK

The CPSFUNC_SET_DATABLOCK function code causes the ComPropSheet function to store a caller-supplied data block. You can use this function code to make the information about a property sheet page available to other pages.

Typically, this function code is used by a _CPSUICALLBACK-typed callback function (when the function's CPSUICBPARAM structure contains a Reason value of CPSUICB_REASON_KILLACTIVE) to save values associated with a page before it becomes inactive.

Parameters (CPSFUNC_SET_DATABLOCK)
Return value (CPSFUNC_SET_DATABLOCK)

If the operation is successful, the ComPropSheet function returns a value representing the number of bytes that were stored; otherwise it returns a value less than or equal to zero.

CPSFUNC_SET_DMPUB_HIDEBITS

The CPSFUNC_SET_DMPUB_HIDEBITS function code causes the ComPropSheet function to "hide" a specified set of document property options, so that they are not displayed.

You can use the CPSFUNC_SET_DMPUB_HIDEBITS function code if you want to define OPTITEM structures for one or more document property sheet options, but you do not want the options to be user-modifiable. The property sheet page must be defined using the COMPROPSHEETUI structure, and the structure's pDlgPage member must be CPSUI_PDLGPAGE_DOCPROP or CPSUI_PDLGPAGE_ADVDOCPROP.

If you use the CPSFUNC_SET_DMPUB_HIDEBITS function code, it must be specified to ComPropSheet before the CPSFUNC_ADD_PCOMPROPSHEETUI or CPSFUNC_INSERT_PSUIPAGE function code is used to create the page.

Parameters (CPSFUNC_SET_DMPUB_HIDEBITS)
Return value (CPSFUNC_SET_DMPUB_HIDEBITS)

If the operation is successful, the ComPropSheet function returns the value specified for lParam1; otherwise it returns zero.

CPSFUNC_SET_FUSION_CONTEXT

The CPSFUNC_SET_FUSION_CONTEXT sets a Fusion activation context for the specified page.

When a page is about to be created or inserted and it does not specify an activation context in its PROPSHEETPAGE structure, it will be created in the parent's page activation context.

If the parent's activation context is not set, then Compstui.dll looks up the parent's parent, continuing until the top level parent is reached or until it finds a parent with an activation context properly set.

If none of the parents has an activation context set, then Compstui.dll will not specify an activation context in the PROPSHEETPAGE structure. This means that the page will be created in the activation context of the caller of the PropertySheet function.

Parameters (CPSFUNC_SET_FUSION_CONTEXT)
Return value (CPSFUNC_SET_FUSION_CONTEXT)

If the operation is successful, the ComPropSheet function returns a value greater than zero. Otherwise, ComPropSheet returns a value that is less than or equal to zero. For information about the error, use the GetLastError function.

CPSFUNC_SET_HSTARTPAGE

The CPSFUNC_SET_HSTARTPAGE function code causes the ComPropSheet function to mark a specified property sheet page to be the top page of the associated property sheet. If the property sheet is currently being displayed, the specified page becomes the active page.

Parameters (CPSFUNC_SET_HSTARTPAGE)
Return value (CPSFUNC_SET_HSTARTPAGE)

If the operation is successful, the ComPropSheet function returns the value specified for lParam1; otherwise it returns zero.

CPSFUNC_SET_PSUIPAGE_ICON

The CPSFUNC_SET_PSUIPAGE_ICON function code causes the ComPropSheet function to add, replace, or remove the icon assigned to the tab of a property sheet page.

If lParam2 contains an icon handle, and if the page specified by lParam1 is currently being displayed, CPSUI adds the icon to the specified page's tab. If an icon is already assigned to the page, the old icon is replaced with the new one. If lParam2 is zero, the current icon (if one exists) is removed.

For all icons specified with the CPSFUNC_SET_PSUIPAGE_ICON function code, CPSUI sets the image size to 16 by 16 pixels.

Icon handles should be obtained by calling LoadImage.

Parameters (CPSFUNC_SET_PSUIPAGE_ICON)
Return value (CPSFUNC_SET_PSUIPAGE_ICON)

If the operation is successful, the ComPropSheet function returns 1. If an error is encountered, or if the specified page is not currently being displayed, the function returns zero.

CPSFUNC_SET_PSUIPAGE_TITLE

The CPSFUNC_SET_PSUIPAGE_TITLE function code causes the ComPropSheet function to set the tab title for a property sheet page.

Parameters (CPSFUNC_SET_PSUIPAGE_TITLE)
Return value (CPSFUNC_SET_PSUIPAGE_TITLE)

If the operation is successful, the ComPropSheet function returns 1. If an error is encountered, or if the specified page is not currently being displayed, the function returns zero.

CPSFUNC_SET_RESULT

The CPSFUNC_SET_RESULT function code causes the ComPropSheet function to pass a specified result value to all PFNPROPSHEETUI-typed functions associated with a specified page and its parents.

For more information about how to set result values, see the description of the SETRESULT_INFO structure.

The following caution applies to Unidrv- or Pscript5-based IHV UI plug-in with custom UI property sheets, and for which user settings made in the property sheets should be persistent. When the plug-in calls the ComPropSheet function with the Function parameter set to CPSFUNC_SET_RESULT, the plug-in must set the lParam2 parameter to CPSUI_OK.

Parameters (CPSFUNC_SET_RESULT)
Return value (CPSFUNC_SET_RESULT)

If the operation is successful, the ComPropSheet function returns the number of PFNPROPSHEETUI-typed functions that were called. If the handle specified for lParam1 is invalid, the function returns -1.