OpenPortEx

BOOL OpenPortEx(
    LPTSTR     pPortName,
    LPTSTR     pPrinterName,
    LPHANDLE   pHandle,
    LPMONITOR  pMonitor
);
 

Opens a port for exchange of bidirectional information with the printer connected to a physical port that is managed by port monitor.

pPortName Points to the name of the port to open (provided by the caller).
pPrinterName Points to the name of the printer that is the destination of the print job (provided by the caller).
pHandle Points to the memory location into which to put the handle to the opened port.
pMonitor Points to a MONITOR structure.

The port handle that the language monitor puts in the location pointed to by pHandle is used by the print provider in subsequent calls to StartDocPort, WritePort, ReadPort, and EndDocPort.