PrtAbortDoc

PrtAbortDoc resets the printer after current print data is flushed. If FLG_COMPLETE_DATA is set, all prior data for this job is sent to the printer. If this flag is clear, PrtAbortDoc first flushes all current write requests for this job and then sends the buffer of data to reset the printer.

Syntax
PrtAbortDoc(hDevice, pchData, cbData, ulFlags);

Parameters

 * hDevice (HFILE) - input
 * The device handle returned by PrtOpen.


 * pchData (PVOID) - input
 * Pointer to the data buffer to write after flushing all current write data.


 * cbData (ULONG) - input
 * Length of data, in bytes, in pchData buffer.


 * ulFlags (ULONG) - input
 * Abort processing flags.

Value is as follows:

FLG_COMPLETE_DATA - 0x00000001 If this flag is set, all prior data for this job must be sent to the printer. If this flag is clear, any buffers waiting to be sent to the printer can be flushed.

Return Code

 * rc (ULONG) - returns
 * Return codes.


 * 0
 * Success


 * 6(ERROR_INVALID_HANDLE)
 * Invalid handle given.


 * 29(ERROR_WRITE_FAULT)
 * Failure attempting to write reset sequence to the device.


 * 32(ERROR_SHARING_VIOLATION)
 * Another thread has access to this port using this Prt handle. This can occur if another thread is in the middle of a PrtClose using this Prt handle.

Remarks
The return code must be checked to ensure that the reset sequence has been sent to the printer.

PrtClose must still be issued to close the device connection.

Example Code



 * 1) define INCL_SPL
 * 2) define INCL_SPLDOSPRINT
 * 3) include 

HFILE   hDevice;  /*  The device handle returned by PrtOpen. */ PVOID   pchData;  /*  Pointer to the data buffer to write after flushing all current write data. */ ULONG   cbData;   /*  Length of data, in bytes, in pchData buffer. */ ULONG   ulFlags;  /*  Abort processing flags. */ ULONG   rc;       /*  Return codes. */

rc = PrtAbortDoc(hDevice, pchData, cbData,      ulFlags);

