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

Identifies the printer.

pBuf

Points 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

Points 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.

See Also

OpenPrinter