OpenPortEx

BOOL (WINAPI *pfnOpenPortEx)(

LPWSTR pPortName,
LPWSTR pPrinterName,
PHANDLE pHandle,
struct _MONITOR FAR *pMonitor
);

OpenPortEx provides a port on which a language monitor and its associated bidirectional printer can communicate.

Parameters

pPortName

Points to a string that specifies the name of the port to be opened.

pPrinterName

Points to a string that specifies the name of the printer that is connected to the port.

pHandle

Points to the location in which the port handle will be returned.

pMonitor

Points to the MONITOR structure defining the routines that a port monitor implements.

Return Value

The return value is TRUE if the function is successful, FALSE if it fails.

Comments

All language monitors must implement OpenPortEx, whereas port monitors implement OpenPort. Monitors that combine both port and language monitor capabilities in one DLL need to implement both OpenPort and OpenPortEx.

OpenPortEx is called by the spooler whenever a port is assigned to the printer identified by pPrinterName. OpenPortEx returns a handle to the port identified by pPortName; this handle is used in subsequent calls to the language monitor's StartDocPort, WritePort, ReadPort, and EndDocPort routines.

OpenPortEx should validate the port monitor identified by pMonitor before calling its OpenPort function to establish a port connection.

Note that the parameter lists for OpenPort and the language monitor's OpenPortEx function differ in that OpenPortEx also receives the printer name and a port monitor's function table.

All language monitors must implement OpenPortEx.

See Also

ClosePort, OpenPort