A port monitor UI DLL's AddPortUI function adds a printer port, then obtains port configuration information from the user and sends it to the port monitor server DLL.
BOOL
AddPortUI(
PCWSTR pszServer,
HWND hWnd,
PCWSTR pszPortNameIn,
PWSTR *ppszPortNameOut
);
If the operation succeeds, the function should return TRUE. Otherwise SetLastError should be called to specify an error code, and the function should return FALSE. If the operation is canceled by the user or is unsupported, the function should call SetLastError(ERROR_CANCELLED), then return FALSE.
Declared in winsplp.h. Include winsplp.h.
Port monitor UI DLLs are required to define an AddPortUI function and include the function's address in a MONITORUI structure.
The spooler calls AddPortUI from within its AddPort function. The first three arguments received by AddPortUI are the arguments received by AddPort. (The AddPort function is described in the Platform SDK documentation.)
The function should perform the following operations:
\\ServerName\,XcvMonitor MonitorName
where ServerName and MonitorName are the server and monitor names received as AddPortUI function arguments.
The call to OpenPrinter requires a PRINTER_DEFAULTS structure, which is described in the Platform SDK documentation. The structure's DesiredAccess member must be set to SERVER_ACCESS_ADMINISTER. Its pDatatype and pDevMode members can be NULL.
This call causes the print monitor server DLL's XcvOpenPort function to be called.
This call causes the server DLL's XcvDataPort function to be called. The XcvDataPort function should return a value that indicates whether the specified port name has already been used. If it has, the UI DLL should request another name from the user and call XcvData again.
This call causes the server DLL's XcvDataPort function to be called again.