ReadPrinter

The ReadPrinter function retrieves data from the specified printer.

BOOL ReadPrinter(
  HANDLE hPrinter,  // handle to printer object
  LPVOID pBuf,      // address of array of bytes that receives data
  DWORD cbBuf,      // size, in bytes, of array
  LPDWORD pNoBytesRead 
                    // address of variable with number of bytes 
                    // retrieved
);
 

Parameters

hPrinter
Handle to the printer for which to retrieve data.
pBuf
Pointer to an array of bytes that receives the printer data.
cbBuf
Specifies the size, in bytes, of the buffer to which pBuf points.
pNoBytesRead
Pointer to a variable that receives the number of bytes of data copied into the array to which pBuf points.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

ReadPrinter returns an error if the device or the printer is not bidirectional.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in winspool.h.
  Import Library: Use winspool.lib.

See Also

Printing and Print Spooler Overview, Printing and Print Spooler Functions, OpenPrinter