AbortDoc

  int AbortDoc(hdc)    
  HDC hdc; /* device-context handle */

The AbortDoc function terminates the current print job and erases everything drawn since the last call to the StartDoc function. This function replaces the ABORTDOC printer escape for Windows version 3.1 and later.

Parameters

hdc

Identifies the device context for the print job.

Return Value

The return value is greater than or equal to zero if the function is successful. Otherwise, it is less than zero.

Comments

Applications should call the AbortDoc function to terminate a print job because of an error or if the user chooses to cancel the job. To end a successful print job, an application should use the EndDoc function.

If Print Manager was used to start the print job, calling the AbortDoc function erases the entire spool job—the printer receives nothing. If Print Manager was not used to start the print job, the data may already have been sent to the printer with AbortDoc is called. In this case, the printer driver resets the printer (when possible) and closes the print job.

See Also

EndDoc, SetAbortProc, StartDoc