GetPrinterInfo

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

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

Parameters

  • hPrint
    [in] Handle obtained from the PrinterOpen function.
  • dwOption
    [in] Specifies the 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 Values

ERROR_SUCCESS indicates success. One of the following values indicates 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 function returns 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 an InkJet 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

OS Versions: Windows CE 2.10 and later.
Header: Prnport.h.

See Also

PrinterOpen | Printer Drivers

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.