Share via


GetPrinterInfo (Windows Embedded CE 6.0)

1/6/2010

This function obtains information about printers, such as the name of the printer or whether the printer can print in color.

Syntax

DWORD WINAPI GetPrinterInfo(
  HANDLE hPrint,
  DWORD dwOption,
  PVOID pBuff,
  PDWORD pBuffLen 
);

Parameters

  • hPrint
    [in] Handle obtained from the PrinterOpen function.
  • dwOption
    [in] Printer option to retrieve.
  • pBuff
    [in] Indicator to determine where to return information. If pBuff is NULL, this function returns the size of the requested information in the pBufLen parameter, including any terminating null characters. If pBuff is not NULL, this function returns the requested information in the location pointed to by pBuff.
  • pBuffLen
    [out] Pointer to the size of the requested data. If pBufLen is NULL, this function returns ERROR_INVALID_PARAMETER.

Return Value

ERROR_SUCCESS indicates success. If ERROR_SUCCESS is not returned, then one of the following values is returned to indicate the type of failure:

  • ERROR_INVALID_PARAMETER
  • ERROR_DEVICE_NOT_READY
  • ERROR_OPENING_PRINT_DEVICE
  • ERROR_NOT_SUPPORTED
  • ERROR_MORE_DATA

Remarks

To retrieve the name of the printer, set dwOption to PRINTER_ID. The pBuff parameter must point to a string previously allocated by the calling application. If pBuff is NULL, this function returns ERROR_SUCCESS, and pBuffLen contains the number of characters needed to store the printer name, including the terminating null character. If pBuffLen is NULL, this function returns ERROR_INVALID_PARAMETER. If pBuffLen is not long enough to hold the name of the printer, this functionreturns ERROR_MORE_DATA along with the correct number of characters needed, including the terminating null character in pBuffLen.

To retrieve the color or black-and-white capabilities of the ink cartridge currently in a printer, set dwOption to PRINTER_PEN. The pBuff parameter points to a DWORD containing one of the values PEN_BLACK or PEN_COLOR. Prnport.h declares these values.

Requirements

Header prnport.h
Windows Embedded CE Windows CE 2.10 and later

See Also

Reference

Printer Driver Functions
PrinterOpen