Performing an Abortable Print Operation

Before beginning a print operation, your application should do the following in order to let the user cancel the operation:

1.Define an abort function as described in the preceding section.

2.Use the MakeProcInstance function to get the procedure-instance address for the abort function.

When your application begins a print operation, it should do the following:

1.Use the Escape function to specify the abort function the application will use during the print operation. When calling Escape, specify the SETABORTPROC value and the procedure-instance address of the application's abort function.

2.Use the CreateDialog, ShowWindow, and UpdateWindow functions to create and display the Abort dialog box.

3.Use the EnableWindow function to disable your parent window.

4.Start the normal print operation, but check the return value from the Escape function after each NEWFRAME escape call. If the return value is less than zero, the user has canceled the operation or an error has occurred.

5.Use the DestroyWindow function to destroy the Abort dialog box, if necessary. (Windows destroys the box automatically if the user cancels the print operation.)

6.Use the EnableWindow function to reenable the parent window.

See the PrntFile sample application, included on the sample disk, for an illustration of how an application performs these steps.