GetPrinterData

  DWORD GetPrinterData(hPrinter, pValueName, pType, pData, nSize, pcbNeeded)    
  HANDLE hPrinter;    
  LPTSTR pValueName;    
  LPDWORD pType;    
  LPBYTE pData;    
  DWORD nSize;    
  LPDWORD pcbNeeded;    

This function retrieves configuration information about the Printer, that had been previously set by the SetPrinter function.

Parameters

hPrinter

Indicates the open Printer handle that this function is to be performed upon. This Handle is obtained with the OpenPrinter API.

pValueName

Indicates the Name of the Data to be retrieved

pType

Unused.

pData

Points to a buffer which will be filled with the configuration information

nSize

Specifies the size of the buffer pointed to by pData.

pcbNeeded

This points to a variable that will be updated to contain the actual buffer size required that is pointed to by pData. If cbBuf is too small then GetLastError will indicate ERROR_BUFFER_TOO_SMALL, and pcbNeeded will contain the size required. If cbBuf is large enough, then pcbNeeded will contain the number of bytes that were copied.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. To obtain extended error information, use the GetLastError function.