GetPrinter

  BOOL GetPrinter(hPrinter, Level, pPrinter, cbBuf, pcbNeeded)    
  HANDLE hPrinter;    
  DWORD Level;    
  LPBYTE pPrinter;    
  DWORD cbBuf;    
  LPDWORD pcbNeeded;    

The GetPrinter function retrieves information about a printer.

Parameters

hPrinter

Identifies the printer to return information about.

Level

This value is either 1, or 2.

pPrinter

Pointer to a PRINTER_INFO_1, or PRINTER_INFO_2 data structure whose fields the function will fill with information about the specified printer.

cbBuf

Specifies the size in bytes of the buffer pointed to by pPrinter.

pcbNeeded

This points to a variable that will be updated to contain the actual buffer size required that is pointed to by pPrinter. 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.