WritePrinter

The WritePrinter function informs the print spooler that data should be written to the specified printer.

BOOL WritePrinter(
  HANDLE hPrinter,
                // handle to printer object
  LPVOID pBuf,  // pointer to array that contains printer data
  DWORD cbBuf,  // size, in bytes, of array
  LPDWORD pcWritten 
                // addr. of variable with count of bytes written
);
 

Parameters

hPrinter
Handle to the printer.
pBuf
Pointer to an array of bytes that contains the data that should be written to the printer.
cbBuf
Specifies the size, in bytes, of the array.
pcWritten
Pointer to a value that specifies the number of bytes of data that were written to the printer.

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.

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