EndDocPort function pointer
A print monitor's EndDocPort function performs the tasks required to end a print job on the specified port.
- hPort [in]
Caller-supplied port handle.
If the operation succeeds, the function should return TRUE. Otherwise it should return FALSE.
A language monitor's EndDocPort function typically calls the associated port monitor's EndDocPort function. It should also notify the spooler when the printing device has finished the job by calling SetJob (described in the Microsoft Windows SDK documentation), specifying a command of JOB_CONTROL_LAST_PAGE_EJECTED. Language monitors for bidirectional printers should not call SetJob until the printer has sent notification that the job is really finished.
A port monitor server DLL's EndDocPort function typically calls the CloseHandle function, described in the Windows SDK documentation, to close the handle that was previously obtained by calling CreateFile from within StartDocPort. It should also notify the spooler when the printing device has finished the job, by calling SetJob, specifying a command of JOB_CONTROL_SENT_TO_PRINTER. (If a spooler is communicating with the port through a language monitor, it doesn't consider the job complete until the language monitor sends JOB_CONTROL_LAST_PAGE_EJECTED.)
The EndDocPort function should free all resources that were allocated by the StartDocPort function.
You might want to modify the EndDocPort function's behavior if the user has deleted or restarted the print job. The function can call GetJob, described in the Windows SDK documentation, and check for a status of JOB_STATUS_DELETING or JOB_STATUS_RESTART, to see if either of these events has occurred.