IWMSPlugins::Remove

banner art

Previous Next

IWMSPlugins::Remove

The Remove method removes an IWMSPlugin interface from the IWMSPlugins collection.

Syntax

  HRESULT Remove(
  VARIANT  varIndex
);

Parameters

varIndex

[in] VARIANT value containing the index or name of the IWMSPlugin interface to remove.

Return Values

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

Return code Number Description
DISP_E_BADINDEX 0x8002000B varIndex is an invalid index location.
NS_E_CANNOT_REMOVE_PLUGIN 0xC00D1451L The plug-in could not be removed.
NS_E_PUBLISHING_POINT_INVALID_REQUEST_WHILE_STARTED 0xC00D1457L The plug-in cannot be removed while the publishing point is running.

Remarks

This method causes the WMS_PLUGIN_REMOVE_ON_SERVICE_RESTART flag to be set. Setting this flag indicates that the plug-in is to be removed when Windows Media server is restarted. The WMS_PLUGIN_REMOVE_ON_SERVICE_RESTART flag can be cleared by setting the plug-in's Enabled property to TRUE.

You can use the IWMSPlugin::get_Name method to find the plug-in name.

You cannot use the Remove method to remove the last instance of a system plug-in. For a plug-in implemented as a DLL, you can instead use RegSvr32.exe.

Example Code

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

// Declare variables and interfaces.
IWMSServer      *pServer;
IWMSPlugins     *pPlugins;

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 an IWMSPlugins interface
// and retrieve the total count of plug-ins.
hr = pServer->get_PlaylistParsers(&pPlugins);
if (FAILED(hr)) goto EXIT;
hr = pPlugins->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;

// Set the first plug-in in the collection
// to be removed when the server restarts.
varIndex = 0;
hr = pPlugins->Remove(varIndex);
if (FAILED(hr)) goto EXIT;

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

Requirements

Header: wmsserver.h.

Library: WMSServerTypeLib.dll.

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

See Also

Previous Next