IWMSPlugins.Remove (C#)

banner art

Previous Next

IWMSPlugins.Remove (C#)

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

Syntax

  IWMSPlugins
  .Remove(
  object  varIndex 
);

Parameters

varIndex

[in] object containing the index or name of the IWMSPlugin object to remove.

Return Values

This method does not return a value.

If this method fails, it throws an exception.

Number Description
0x8002000B varIndex is an invalid index location.
0xC00D1451L The plug-in could not be removed.
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.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 that is implemented as a DLL, you can use RegSvr32.exe instead.

Example Code

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer          Server;
IWMSPlugins        Plugins;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the IWMSPlugins object.
    Plugins = Server.EventHandlers;

    // Set the first plug-in in the collection
    // to be removed when the server restarts.
    Plugins.Remove (0);
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

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

See Also

Previous Next