IWMSWMIBridgeAdmin::put_ExposedEventClasses

The put_ExposedEventClasses method specifies an enumeration value containing the event classes exposed by Windows Management Instrumentation.

HRESULT put_ExposedEventClasses(
  WMS_EVENT_CLASS  ExposedEventClasses
);

Arguments

ExposedEventClasses

[in] WMS_EVENT_CLASS enumeration value containing the event classes. This must be an exclusive OR of the following values.

Value

Description

WMS_WMI_CLASS_UNKNOWN

Indicates an unknown event class.

WMS_WMI_CLASS_CLIENT

Indicates Windows Management Instrumentation (WMI) events for the client.

WMS_WMI_CLASS_SERVER

Indicates WMI events for the server.

WMS_WMI_CLASS_PUBLISHING_POINT

Indicates WMI events for the publishing point.

WMS_WMI_CLASS_LIMIT_CHANGE

Indicates WMI events for limit changes.

WMS_WMI_CLASS_LIMIT_HIT

Indicates WMI events for limit hits.

WMS_WMI_CLASS_PLUGIN

Indicates WMI events for plug-ins.

WMS_WMI_CLASS_CACHE

Indicates WMI events for a cache.

WMS_WMI_CLASS_PLAYLIST

Indicates WMI events for playlists.

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Return code

Number

Description

E_FAIL

0x80004005

The server cannot find the WMS WMI Event Handler plug-in.

Example

#include <windows.h>
#include <atlbase.h>    // Includes CComVariant.

// To access system plug-in interfaces, the
// entire type library must be imported as shown.
#import "WMSServerTypeLib.dll" no_namespace named_guids \
                               raw_interfaces_only

// Declare variables and interfaces.
IWMSServer          *pServer;
IWMSPlugins         *pPlugins;
IWMSPlugin          *pPlugin;
IDispatch           *pDispatch;
IWMSWMIBridgeAdmin  *pWMIBridgeAdmin;

HRESULT         hr;
CComVariant     varIndex;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
                      NULL,
                      CLSCTX_ALL,
                      IID_IWMSServer,
                      (void **)&pServer);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to an IWMSPlugins interface
// containing event handler plug-ins.
hr = pServer->get_EventHandlers(&pPlugins);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the IWMSPlugin interface
// of the plug-in to be configured.
varIndex = "WMS WMI Event Handler";
hr = pPlugins->get_Item(varIndex, &pPlugin);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the custom interface
// of the plug-in.
hr = pPlugin->get_CustomInterface(&pDispatch);
if (FAILED(hr)) goto EXIT;

// Query the specific administration interface
// for the plug-in.
hr = pDispatch->QueryInterface(IID_IWMSWMIBridgeAdmin,
                              (void **)&pWMIBridgeAdmin);
if (FAILED(hr)) goto EXIT;

// Set the event classes exposed by
// Windows Management Instrumentation.
DWORD dwEventClasses = WMS_WMI_CLASS_LIMIT_HIT |
                       WMS_WMI_CLASS_SERVER |
                       WMS_WMI_CLASS_PUBLISHING_POINT;
hr = pWMIBridgeAdmin->put_ExposedEventClasses(
                       (WMS_EVENT_CLASS)dwEventClasses);
if (FAILED(hr)) goto EXIT;

EXIT:
    // TODO: Release temporary COM objects and uninitialize COM.

Requirements

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Reference

IWMSWMIBridgeAdmin Interface