SETABORTPROC

short Escape(hdc, SETABORTPROC, NULL,lpAbortFunc, NULL)

The SETABORTPROC printer escape is maintained for backwards compatibility. Applications written for Windows 3.1 should use the SetAbortProc function.

This escape sets the Abort function for the print job.

To allow a print job to be canceled during spooling, an application must set the Abort function before the print job is started with the STARTDOC escape. Print Manager calls the Abort function during spooling to allow the application to cancel the print job or to take appropriate action for such errors as running out of disk space. If no Abort function is set, the print job will fail if there is not enough disk space for spooling.

Parameters

hdc

HDC Identifies the device context.

lpAbortFunc

FARPROC Points to the application-supplied Abort function. For details, see the following Comments section.

Return Value

The return value specifies the outcome of the escape. This value is greater than zero if the escape is successful. Otherwise, it is less than zero.

Comments

The address passed as the lpAbortFunc parameter must be created by using the MakeProcInstance function.

The callback function must use the Pascal calling convention and must be declared FAR. The Abort function must have the following form:

short FAR PASCAL AbortFunc(hPr,code)
HDC hPr;
short code;

AbortFunc is a placeholder for the application-supplied function name. The actual name must be exported by including it in an EXPORTS statement in the module-definition (.DEF) file for the application.

Following are the parameters in the Abort function:

hPr

Identifies the device context.

code

Specifies whether an error has occurred. This parameter is zero if no error has occurred. It is SP_OUTOFDISK if Print Manager is currently out of disk space and more disk space will become available if the application waits.

If code is SP_OUTOFDISK, the application does not have to abort the print job. If it does not abort the print job, it must yield to Print Manager by calling the PeekMessage or GetMessage function.

Return Value

The return value should be nonzero if the print job is to continue and zero if it is canceled.