Condividi tramite


EndDocPort function pointer

A print monitor's EndDocPort function performs the tasks required to end a print job on the specified port.

Syntax

typedef BOOL ( WINAPI *pfnEndDocPort)(
  _In_ HANDLE hPort
);

Parameters

  • hPort [in]
    Caller-supplied port handle.

Return value

If the operation succeeds, the function should return TRUE. Otherwise it should return FALSE.

Remarks

Language monitors and port monitor server DLLs are required to define an EndDocPort function and include the function's address in a MONITOR2 structure.

The handle received as the function's hPort argument is the port handle that the monitor's OpenPort or OpenPortEx function supplied.

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.

Requirements

Target platform

Desktop

Header

Winsplp.h (include Winsplp.h)

See also

OpenPort

OpenPortEx

 

 

Send comments about this topic to Microsoft