IWMSDiagnosticEvent Interface

banner art

Previous Next

IWMSDiagnosticEvent Interface

The IWMSDiagnosticEvent interface contains information about a specific event notice that you can use to diagnose problems concerning the configuration of the server or the status of a plug-in.

In addition to the methods inherited from IDispatch, the IWMSDiagnosticEvent interface exposes the following methods.

Method Description
get_AdditionalInfo Retrieves the text message associated with the event notice.
get_ErrorCode Retrieves the HRESULT return code associated with the event notice.
get_Name Retrieves the name of the plug-in or server limit associated with the event notice.
get_NumberOfOccurrences Retrieves the number of times the event notice has occurred.
get_PublishingPointName Retrieves the name of the publishing point that raised the event notice.
get_Time Retrieves the date and time of the event notice.
get_Type Retrieves an enumeration value indicating the type of the event notice.

Example Code

The following example illustrates how to retrieve a pointer to an IWMSDiagnosticEvent interface.

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

// Declare variables and interfaces.
IWMSServer              *pServer;
IWMSDiagnosticEvents    *pDiagnosticEvents;
IWMSDiagnosticEvent     *pDiagnosticEvent;

HRESULT         hr;
CComVariant     varIndex;
long            lCount;

// 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 the IWMSDiagnosticEvents
// interface and retrieve the total count of events.
hr = pServer->get_DiagnosticEvents(&pDiagnosticEvents);
if (FAILED(hr)) goto EXIT;
hr = pDiagnosticEvents->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;

// Retrieve information about each diagnostic event.
for (long x = 0; x < lCount; x++)
{
    varIndex = x;
    hr = pDiagnosticEvents->get_Item(varIndex, &pDiagnosticEvent);
    if (FAILED(hr)) goto EXIT;

    // Release temporary COM objects.
    pDiagnosticEvent->Release();
}

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

See Also

Previous Next