IPrintCoreHelperUni::WhyConstrained method

The IPrintCoreHelperUni::WhyConstrained method provides a list of options that constrain the specified feature-option pair in the current configuration.


STDMETHOD WhyConstrained(
  [in, optional] CONST DEVMODE              *pDevmode,
  [in]           DWORD                      cbSize,
  [in]           PCSTR                      pszFeatureKeyword,
  [in]           PCSTR                      pszOptionKeyword,
  [out]          CONST PRINT_FEATURE_OPTION **ppFOConstraints,
  [out]          DWORD                      *pdwNumOptions


pDevmode [in, optional]

A pointer to a DEVMODEW structure. If this pointer is provided, IPrintCoreHelperUni::WhyConstrained should use the DEVMODEW structure that is pointed to by pDevmode instead of the default or current DEVMODEW structure. If this method is called from the plug-in provider or from IPrintOemUni::DevMode, this parameter is required. In most other situations, the parameter should be NULL. When the core driver sets pDevmode to NULL, it modifies its internal state rather than that of the passed-in DEVMODEW structure. This is required during operations such as full UI replacement, where the DEVMODEW structure returned by a DDI, such as DrvDocumentPropertySheets, is being serviced by the core driver's UI module.

cbSize [in]

The size, in bytes, of the DEVMODEW structure that is pointed to by the pDevmode parameter.

pszFeatureKeyword [in]

A pointer to an ANSI string that contains the name of the feature. The feature name should correspond to the keyword that is used in the GPD file.

pszOptionKeyword [in]

A pointer to an ANSI string that contains the name of the option. The option name should correspond to the keyword that is used in the GPD file.

ppFOConstraints [out]

A pointer to an array of PRINT_FEATURE_OPTION elements. When IPrintCoreHelperUni::WhyConstrained returns, the array contains a list of feature-element pairs of the options that constrain the options that are specified in the pszOptionKeyword parameter.

pdwNumOptions [out]

A pointer to a variable that receives the number of feature-option pairs in the array pointed to by the ppFOConstraints parameter.

Return value

IPrintCoreHelperUni::WhyConstrained should return one of the following values.

Return codeDescription

The operation succeeded.


One or more of the arguments is invalid, or the feature was not supported.


Memory for the result array could not be allocated.


For other failures, the method should return a standard COM error code.


If the specified feature-option pair is not constrained, IPrintCoreHelperUni::WhyConstrained will return S_OK but will return with *pdwFOPairs set to 0 and with *ppFOConstraints[0] set to NULL.

Note that the results from this method might not contain all of the options that affect the currently selected option. If there are invalid combinations that list more than two feature-option pairs, however, only one option from the combination will be included in the list.


Target platform



Prcomoem.h (include Prcomoem.h)

See also




Send comments about this topic to Microsoft