IWMSPlugin.ErrorCode (C#)
.gif)
| Previous | Next |
IWMSPlugin.ErrorCode (C#)
The ErrorCode property retrieves an HRESULT error code for the plug-in.
Syntax
int = Plugin.ErrorCode;
Property Value
int 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
using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;
// Declare variables.
WMSServer Server;
IWMSPlugins Plugins;
IWMSPlugin Plugin;
int iValue;
try {
// Create a new WMSServer object.
Server = new WMSServerClass();
// Retrieve the IWMSPlugins object.
Plugins = Server.Authenticators;
// Retrieve information about each plug-in.
for (int i = 0; i < Plugins.Count; i++)
{
Plugin = Plugins[i];
// 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)
{
iValue = Plugin.ErrorCode;
}
}
}
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 |