Share via


IWMSPlugin.ErrorCode (Visual Basic .NET)

banner art

Previous Next

IWMSPlugin.ErrorCode (Visual Basic .NET)

The ErrorCode property retrieves an HRESULT error code for the plug-in.

Syntax

  Integer = Plugin.ErrorCode

Property Value

Integer containing the error code.

Remarks

This property is read-only. It is valid only if the bit flag is set on the value returned by the IWMSPlugin.Status property. The bit flag identifies the state of the plug-in.

You can use the IWMSLoggingAdmin object to record plug-in errors in the Windows event log. If the event log contains a WMS_EVENT_LOG_LEVEL_ERROR, the HRESULT specified in the IWMSLoggingAdmin object is returned by the ErrorCode method.

Example Code

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

Private Sub GetErrorCode()

    ' Declare variables.
    Dim Server As WMSServer
    Dim Plugins As IWMSPlugins
    Dim Plugin As IWMSPlugin
    Dim iValue As Integer

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

    ' Retrieve the IWMSPlugins object.
    Plugins = Server.Authenticators

    ' Retrieve information about each plug-in.
    For Each Plugin In Plugins

        ' Retrieve the current status of the plug-in.
        iValue = Plugin.Status

        ' Retrieve error information if the plug-in
        ' is in error status.
        If iValue = WMS_PLUGIN_STATUS.WMS_PLUGIN_ERROR Then
            iValue = Plugin.ErrorCode
        End If

    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