## Printer Device Driver

[prev][next][parent][TOC]

### Virtual-Printer Ports

The spooler allows applications and port drivers to communicate with printers that are not connected to the print subsystem in OS/2. This is done by allowing the port driver to use a virtual port to connect to non-OS /2 printers. This allows query and set commands to be sent to these printers, but the OS/2 print subsystem is not allowed to select these printer ports for output.

An application can add a virtual-printer port by calling SplCreatePort. The application must know extra information about the port driver to be allowed to create a virtual port-such as the network adapter address-and this information is passed into SplCreatePort.

When SplCreatePort is called with a unique port name, the spooler calls the port driver with command BIDI_ADD_VIRTUAL_PORT, passing the data buffer supplied by the application. If this is the first port installed by the port driver, the port driver is first called with BIDI_INIT_PORTDRV to allow the port driver to initialize. If this is successful, the port driver is called to add the virtual port.

Once the virtual port is created, the application can issue queries to the printer using the virtual-port name. When the application no longer needs a virtual port, the application should remove the port by calling SplDeletePort. This causes the spooler to call the port driver with command BIDI_DEL_VIRTUAL_PORT.

Virtual ports allow use of the existing port-driver and protocol-converter interfaces while not allowing the user to select the virtual port as an output port. These virtual ports do not get stored in the INI file, and they are deleted when the spooler is disabled or when the system is rebooted.

See the OS/2 Presentation Device Driver Reference for detailed information on these APIs, their syntax, and their parameters.

SplCreatePort Called to create a printer port.
SplDeletePort Called to remove a printer port.