short Escape(hDC, SETABORTPROC,NULL, lpAbortFunc, NULL)
This escape sets the abort function for the print job.
If an application is to allow the print job to be canceled during spooling, it 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 process out-of-disk-space conditions. If no abort function is set, the print job will fail if there is not enough disk space for spooling.
Parameter | Type/Description |
hDC | HDC Identifies the device context. | |
lpAbortFunc | FARPROC Points to the application-supplied abort function. See the following “Comments” section for details. |
The return value specifies the outcome of the escape. It is positive if the escape is successful. Otherwise, it is negative.
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 application's module-definition file.
Parameter | Description |
hPr | Identifies the device context. | |
code | Specifies whether an error has occurred. It 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, 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.