When a program is printing, the bulk of the work takes place during the NEWFRAME Escape call. Before that call, the GDI module simply adds another record to the disk-based metafile every time the program calls a GDI drawing function. When GDI gets the NEWFRAME Escape call, it plays this metafile into the device driver once for each band the device driver defines on a page. GDI then stores the printer output created by the printer driver in a file. If the Print Manager isn't loaded, the GDI module itself must write this printer output to the printer.
During the NEWFRAME Escape call, the GDI module calls the abort procedure you've set. Normally, the nCode parameter is 0, but if GDI has run out of disk space because of the presence of other temporary files that haven't been printed yet, then the nCode parameter is SP_OUTOFDISK. (You wouldn't normally check this value, but you can if you want.) The abort procedure then goes into its PeekMessage loop. The loop first retrieves messages from the program's own message queue and then yields control so that other programs can retrieve and process their own messages. When no messages remain in any program's queue, control passes to another program currently waiting for its own PeekMessage call to return.
One of those programs is PRINTMAN.EXE, which also uses a PeekMessage call to retrieve messages. When the Print Manager returns from the PeekMessage call in its own message loop, it can transfer part of a disk file to the printer. The Print Manager then calls PeekMessage again in its own message loop. If there are still no messages in any program's message queue, control returns to AbortProc, and PeekMessage returns FALSE. The abort procedure then drops out of its message loop and returns a TRUE value to the GDI module to indicate that printing should continue. The GDI module then continues to process the NEWFRAME Escape call.
While the main purpose of the abort procedure is to allow the Print Manager the opportunity to transfer existing files to the printer to free up disk space, it also allows all other programs to run during the time a program is printing. This effect of the abort procedure is particularly important if the Print Manager isn't installed.