12.6.5 Canceling a Print Operation with the AbortDoc Function
You can use the AbortDoc function to cancel a print operation, even if you do not have a print-canceling function or an Abort dialog box. Applications can use AbortDoc to cancel the operation at any time.