ConvertPrintTicketToDevModeThunk2 function

[This function is not supported and might be disabled or deleted in future versions of Windows. PTConvertPrintTicketToDevMode provides equivalent functionality and should be used instead.]

Converts a print ticket to a DEVMODE structure.


HRESULT ConvertPrintTicketToDevModeThunk2(
  _In_      HPTPROVIDER hProvider,
  _In_      BYTE        *pPrintTicket,
  _In_      ULONG       cbSize,
  _In_      INT         baseType,
  _In_      DWORD       scope,
  _Out_     BYTE        **ppDevmode,
  _Out_     ULONG       *pcbDevModeLength,
  _Out_opt_ BSTR        *errMsg


hProvider [in]

A handle to an open print ticket provider. This handle is returned by the BindPTProviderThunk function.

pPrintTicket [in]

The buffer that contains the print ticket to convert.

cbSize [in]

The size, in bytes, of the buffer passed in pPrintTicket.

baseType [in]

A value indicating whether the user's default DEVMODE or the print queue's default DEVMODE is used to provide values to the output DEVMODE when pPrintTicket does not specify every possible setting for a DEVMODE. The value of this parameter must be a member of the EDefaultDevmodeType enumeration, cast as an INT.

scope [in]

A value that specifies the scope of pPrintTicket. This value can specify a single page, an entire document, or all documents in the print job. The value of this parameter must be a member of the EPrintTicketScope enumeration, cast as a DWORD.

ppDevmode [out]

The address of the newly created DEVMODE. This function calls CoTaskMemAlloc to allocate this buffer. When the buffer is no longer needed, the caller must free it by calling CoTaskMemFree.

pcbDevModeLength [out]

The size, in bytes, of the DEVMODE returned in ppDevmode.

errMsg [out, optional]

A pointer to a string that specifies what, if anything, is invalid about the print ticket in pPrintTicket. If it is valid, this is NULL. If errMsg is not NULL when the function returns, the caller must free the string with SysFreeString.

Return value

If the method succeeds, it returns S_OK; otherwise, it returns an HRESULT error code. For more information about COM error codes, see Error Handling.


Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]



See also

Print Schema
Print Spooler API Functions