StartDocPort function pointer

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

Syntax

typedef BOOL ( WINAPI *pfnStartDocPort)(
  _In_ HANDLE hPort,
  _In_ LPWSTR pPrinterName,
  _In_ DWORD  JobId,
  _In_ DWORD  Level,
  _In_ LPBYTE pDocInfo
);

Parameters

  • hPort [in]
    Caller-supplied port handle.

  • pPrinterName [in]
    Caller-supplied pointer to a string containing the printer name.

  • JobId [in]
    Caller-supplied, spooler-assigned job identifier.

  • Level [in]
    Caller-supplied value indicating the type of structure pointed to by pDocInfo. Possible values are as follows:

    Level pDocInfo

    1

    DOC_INFO_1

    2

    DOC_INFO_2

     

  • pDocInfo [in]
    Caller-supplied pointer to a DOC_INFO_1 or DOC_INFO_2 structure. These structures are described in the Microsoft Windows SDK documentation.

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 a StartDocPort 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 StartDocPort function typically calls the associated port monitor's StartDocPort function.

A port monitor server DLL's StartDocPort function typically calls the CreateFile function, described in the Windows SDK documentation, to create a connection to the kernel-mode port driver.

If necessary, the port monitor should prevent other processes from using the specified port until EndDocPort is called. For example, a port monitor for a COM port must ensure that, while a spooler is sending printer data to the port, another application does not assume the port is connected to a particular communications device and then attempt to communicate with that device. This cautionary note does not apply to the local print provider, which guarantees that it never calls StartDocPort twice in succession without an intervening call to EndDocPort, but it does apply to print providers that do not make this guarantee.

Requirements

Target platform

Desktop

Header

Winsplp.h (include Winsplp.h)

See also

OpenPort

OpenPortEx

EndDocPort

 

 

Send comments about this topic to Microsoft