Bewerken

Delen via


Add a port

Adding a port consists of storing the port's name and user-modifiable configuration information inside the port monitor server DLL's local storage or in the registry.

When an application calls the print spooler's AddPort function, it specifies the name of a port monitor as a function argument. The spooler calls the AddPortUI function contained in the port monitor UI DLL of the specified port monitor.

The port monitor UI DLL's AddPortUI function should perform the following operations:

  1. Call the print spooler's OpenPrinter function, which causes the XcvOpenPort function in the port monitor server DLL to be called.

  2. Call the print spooler's XcvData function several times, to request the port monitor server DLL to add the port and to transfer configuration information between the UI DLL and the server DLL. The XcvData function calls the server DLL's XcvDataPort function. The AddPortUI function typically obtains configuration information from the user by displaying dialog boxes.

  3. Call the print spooler's ClosePrinter function, which causes the XcvClosePort function in the port monitor server DLL to be called.

For more information about these operations, see the description of AddPortUI. Also see Storing Port Configuration Information.

A port monitor's EnumPorts function must enumerate all ports that have been added. The spooler can call each port monitor's EnumPorts function to determine the set of ports supported on a print server.