MONITOR2 structure (winsplp.h)

The MONITOR2 structure contains pointers to the functions defined by print monitors.

Syntax

typedef struct _MONITOR2 {
  DWORD  cbSize;
  BOOL( )(HANDLE hMonitor,LPWSTR pName,DWORD Level,LPBYTE pPorts,DWORD cbBuf,LPDWORD pcbNeeded,LPDWORD pcReturned)  *pfnEnumPorts;
  BOOL( )(HANDLE hMonitor,LPWSTR pName,PHANDLE pHandle)  *pfnOpenPort;
  BOOL()(HANDLE hMonitor,HANDLE hMonitorPort,LPWSTR pPortName,LPWSTR pPrinterName,PHANDLE pHandle,_MONITOR2 *pMonitor2)  * pfnOpenPortEx;
  BOOL( )(HANDLE hPort,LPWSTR pPrinterName,DWORD JobId,DWORD Level,LPBYTE pDocInfo)  *pfnStartDocPort;
  BOOL( )(HANDLE hPort,LPBYTE pBuffer,DWORD cbBuf,LPDWORD pcbWritten)  *pfnWritePort;
  BOOL( )(HANDLE hPort,LPBYTE pBuffer,DWORD cbBuffer,LPDWORD pcbRead)  *pfnReadPort;
  BOOL( )(HANDLE hPort)  *pfnEndDocPort;
  BOOL( )(HANDLE hPort)  *pfnClosePort;
  BOOL( )(HANDLE hMonitor,LPWSTR pName,HWND hWnd,LPWSTR pMonitorName)  *pfnAddPort;
  BOOL( )(HANDLE hMonitor,LPWSTR pName,DWORD Level,LPBYTE lpBuffer,LPWSTR lpMonitorName)  *pfnAddPortEx;
  BOOL( )(HANDLE hMonitor,LPWSTR pName,HWND hWnd,LPWSTR pPortName)  *pfnConfigurePort;
  BOOL( )(HANDLE hMonitor,LPWSTR pName,HWND hWnd,LPWSTR pPortName)  *pfnDeletePort;
  BOOL( )(HANDLE hPort,DWORD ControlID,LPWSTR pValueName,LPWSTR lpInBuffer,DWORD cbInBuffer,LPWSTR lpOutBuffer,DWORD cbOutBuffer,LPDWORD lpcbReturned)  *pfnGetPrinterDataFromPort;
  BOOL( )(HANDLE hPort,LPCOMMTIMEOUTS lpCTO,DWORD reserved)  *pfnSetPortTimeOuts;
  BOOL( )(HANDLE hMonitor,LPCWSTR pszObject,ACCESS_MASK GrantedAccess,PHANDLE phXcv)  *pfnXcvOpenPort;
  DWORD( )(HANDLE hXcv,LPCWSTR pszDataName,PBYTE pInputData,DWORD cbInputData,PBYTE pOutputData,DWORD cbOutputData,PDWORD pcbOutputNeeded) *pfnXcvDataPort;
  BOOL( )(HANDLE hXcv)  *pfnXcvClosePort;
  VOID( )(HANDLE hMonitor)  *pfnShutdown;
  DWORD()(HANDLE hPort,DWORD dwAccessBit,LPCWSTR pAction,PBIDI_REQUEST_CONTAINER pReqData,PBIDI_RESPONSE_CONTAINER *ppResData) * pfnSendRecvBidiDataFromPort;
  DWORD()(HANDLE hMonitor,DWORD cPorts,PCWSTR *ppszPorts) * pfnNotifyUsedPorts;
  DWORD()(HANDLE hMonitor,DWORD cPorts,PCWSTR *ppszPorts) * pfnNotifyUnusedPorts;
  DWORD()(HANDLE hMonitor,DWORD event,POWERBROADCAST_SETTING *pSettings) * pfnPowerEvent;
} MONITOR2, *PMONITOR2, *LPMONITOR2;

Members

cbSize

Specifies the size, in bytes, of the MONITOR2 structure.

pfnEnumPorts

A port monitor server DLL's EnumPorts function enumerates the ports that the port monitor supports.

pfnOpenPort

Pointer to the print monitor's OpenPort function.

pfnOpenPortEx

A language monitor's OpenPortEx function opens a printer port.

pfnStartDocPort

A print monitor's StartDocPort function performs the tasks required to start a print job on the specified port.

pfnWritePort

Pointer to the print monitor's WritePort function.

pfnReadPort

Pointer to the print monitor's ReadPort function.

pfnEndDocPort

A print monitor's EndDocPort function performs the tasks required to end a print job on the specified port.

pfnClosePort

Pointer to the print monitor's ClosePort function.

pfnAddPort

Caution

The AddPort function is obsolete and should not be used.

AddPort creates a port and adds it to the list of ports currently supported by the specified monitor in the spooler environment.

pfnAddPortEx

(Obsolete. Must be NULL.) Pointer to the print monitor's AddPortEx function. (Port monitors only.)

pfnConfigurePort

Caution

The ConfigurePort function is obsolete and should not be used. Use ConfigurePortUI instead.

ConfigurePort is a port management function that configures the specified port.

pfnDeletePort

Caution

The DeletePort function is obsolete and should not be used.

DeletePort deletes a port from the monitor's environment.

pfnGetPrinterDataFromPort

Pointer to the print monitor's GetPrinterDataFromPort function.

pfnSetPortTimeOuts

A port monitor server DLL's SetPortTimeOuts function sets port time-out values for an open port.

pfnXcvOpenPort

Pointer to the print monitor's XcvOpenPort function. (Port monitors only.)

pfnXcvDataPort

Pointer to the print monitor's XcvDataPort function. (Port monitors only.)

pfnXcvClosePort

Pointer to the print monitor's XcvClosePort function. (Port monitors only.)

pfnShutdown

Pointer to the print monitor's Shutdown function.

pfnSendRecvBidiDataFromPort

Pointer to the print monitor's SendRecvBidiDataFromPort function.

pfnNotifyUsedPorts

Pointer to the print monitor's NotifyUsedPorts function.

pfnNotifyUnusedPorts

Pointer to the print monitor's NotifyUnusedPorts function.

pfnPowerEvent

Pointer to the print monitor's PowerEvent function.

Remarks

Each language monitor and each port monitor server DLL must provide a MONITOR2 structure. The monitor must supply values for all structure members, and specify the structure's address as the return value for its InitializePrintMonitor2 function.

If a function is not defined, its pointer must be NULL.

The MONITOR2 structure is larger in Windows XP than it was in Windows 2000. In order to ensure that a monitor developed with the Windows XP Driver Development Kit (DDK) will install on Windows XP and Windows 2000, the monitor must do the following:

  • Perform a run-time check to determine which operating system version the monitor is running on.
  • If the monitor is running on Windows 2000, it must set the cbSize member of the MONITOR2 structure to MONITOR2_SIZE_WIN2K (defined in Winsplp.h), the size appropriate for Windows 2000 version of this structure.

The following function determines whether the current operating system version is Windows 2000.

BOOL  Is_Win2000()
{
  OSVERSIONINFOEX osvi;
  DWORDLONG dwlConditionMask = 0;

  // Initialize the OSVERSIONINFOEX structure.

  ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
  osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
  osvi.dwMajorVersion = 5;
  osvi.dwMinorVersion = 0;

  // Initialize the condition mask.
  VER_SET_CONDITION( dwlConditionMask, VER_MAJORVERSION, VER_EQUAL );
  VER_SET_CONDITION( dwlConditionMask, VER_MINORVERSION, VER_EQUAL );

  // Perform the test.
  return VerifyVersionInfo(
      &osvi,
      VER_MAJORVERSION | VER_MINORVERSION,
      dwlConditionMask);
}

For a monitor that is loading on Windows 2000, the following code sets the MONITOR2 structure's cbSize member appropriately.

if ( Is_Win2000( ) )
    Monitor2.cbSize = MONITOR2_SIZE_WIN2K;

Requirements

Requirement Value
Header winsplp.h (include Winsplp.h)

See also

InitializePrintMonitor2

MONITORUI