Share via


IWMSPlugins.Clone (Visual Basic .NET)

banner art

Previous Next

IWMSPlugins.Clone (Visual Basic .NET)

The Clone method creates a duplicate instance of a specific IWMSPlugin object.

Syntax

  IWMSPlugin = IWMSPlugins.Clone(
  strDestName As String,
  SrcPlugin As IWMSPlugin
)

Parameters

strDestName

[in] String containing the name of the plug-in to create.

SrcPlugin

[in] IWMSPlugin object to clone.

Property Value

An IWMSPlugin object.

If this property fails, it returns an error number.

Number Description
0xC00D0036L strDestName is already being used by another plug-in in the current plug-in collection.
0xC00D1396L strDestName contains an invalid character. Invalid characters are: & " ' < > \
0xC00D1394L strDestName is a zero-length string.
0xC00D1392L strDestName is longer than the maximum allowed length.

Remarks

All property values are copied to the new plug-in except the Enabled property, which is set to False.

The WMS_PLUGIN_REMOVE_ON_SERVICE_RESTART flag for the duplicate plug-in is set to False. The value for this flag is accessible from the IWMSPlugin.Status method.

Example Code

Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices

Private Sub CreateClone()

    ' Declare variables.
    Dim Server As WMSServer
    Dim Plugins As IWMSPlugins
    Dim Plugin As IWMSPlugin
    Dim PluginClone As IWMSPlugin
    Dim strText As String

Try
    ' Create the WMSServer object.
    Server = New WMSServer()

    ' Retrieve the IWMSPlugins object.
    Plugins = Server.EventHandlers

    ' Retrieve information about each plug-in.
    For Each Plugin In Plugins
        ' Clone the plug-in.
        strText = "Cloned Plugin"
        PluginClone = Plugins.Clone(strText, Plugin)
    Next

Catch excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle errors.
Finally
    ' TODO: Clean-up code goes here.
End Try

End Sub

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