CDC::AbortDoc

Syntax

int AbortDoc();

Remarks

Terminates the current print job, erasing everything the application has written to the device since the last call to EndDoc.

This member function is provided as a convenient way to send the ABORTDOC escape. It allows the application to access facilities of a particular device that are not directly available through GDI. The escape call is translated and sent to the device driver.

AbortDoc should be used to terminate:

Printing operations that do not specify an abort function using SetAbortProc.

Printing operations that have not yet reached their first NEWFRAME or NEXTBAND escape call.

If an application encounters a printing error or a canceled print operation, it must not attempt to terminate the operation by using either the EndDoc or AbortDoc member functions of class CDC. GDI automatically terminates the operation before returning the error value.

If the application displays a dialog box to allow the user to cancel the print operation, it must call AbortDoc before destroying the dialog box.

Return Value

A positive value if successful, or a negative value if an error has occurred. The following list shows common error values:

Value Meaning

SP_ERROR General error.
SP_OUTOFDISK Not enough disk space is currently available for spooling, and no more space will become available.
SP_OUTOFMEMORY Not enough memory is available for spooling.
SP_USERABORT User terminated the job through the Print Manager.

See Also

::AbortDoc