DeletePortUI function pointer
A port monitor UI DLL's DeletePortUI function deletes a printer port.
typedef BOOL ( WINAPI *pfnDeletePortUI)( _In_opt_ PCWSTR pszServer, _In_ HWND hWnd, _In_ PCWSTR pszPortName );
- pszServer [in, optional]
Caller-supplied pointer to a string representing a server name, or NULL if the printer is local. (The port monitor can ignore this parameter.)
- hWnd [in]
Caller-supplied handle of the window that should be used as the parent for dialog boxes. If NULL, no dialog boxes should be displayed.
- pszPortName [in]
Caller-supplied pointer to a string representing the name of the port to be deleted.
If the operation succeeds, the function should return TRUE. Otherwise it should return FALSE. If the operation is canceled by the user or is unsupported, the function should call SetLastError(ERROR_CANCELLED), then return FALSE.
Port monitor UI DLLs are required to define a DeletePortUI function and include the function's address in a MONITORUI structure.
The spooler calls DeletePortUI from within its DeletePort function. The arguments received by DeletePortUI are the arguments received by DeletePort. (The DeletePort function is described in the Microsoft Windows SDK documentation.)
The function should perform the following operations:
Call OpenPrinter, specifying a printer name with the following format:
where ServerName and PortName are the server and port names received as DeletePortUI function arguments.
The call to OpenPrinter requires a PRINTER_DEFAULTS structure, which is described in the Windows 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.
Call XcvData, specifying the following input arguments:
- The handle received from OpenPrinter
- The port name received as a function argument
- A data name string of "DeletePort"
This call causes the server DLL's XcvClosePort function to be called.
If user interaction is required, obtain information from the user by displaying a dialog box and then call XcvData, specifying customized data name strings, to send the information to the server DLL. The XcvData call causes the server's XcvDataPort function to be called.
Call ClosePrinter, specifying the handle received from OpenPrinter. This causes the server DLL's XcvClosePort function to be called.