CDC::AbortDoc

int AbortDoc( );

Return Value

A value greater than or equal to 0 if successful, or a negative value if an error has occurred. The following list shows common error values and their meanings:

Remarks

Terminates the current print job and erases everything the application has written to the device since the last call to the StartDoc member function.

This member function replaces the ABORTDOC printer escape.

AbortDoc should be used to terminate the following:

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.

If Print Manager was used to start the print job, calling AbortDoc erases the entire spool job — the printer receives nothing. If Print Manager was not used to start the print job, the data may have been sent to the printer before AbortDoc was called. In this case, the printer driver would have reset the printer (when possible) and closed the print job.

Example

See the example for CDC::StartDoc.

CDC OverviewClass MembersHierarchy Chart

See Also   CDC::StartDoc, CDC::EndDoc, CDC::SetAbortProc