IWMSPlugin::get_Status
Previous | Next |
IWMSPlugin::get_Status
The get_Status method retrieves the status of the plug-in.
Syntax
HRESULT get_Status( long* pVal );
Parameters
pVal
[out] Pointer to a long. The bit field of the long contains an enumeration value from the WMS_PLUGIN_STATUS enumeration type. This must be a logical OR of one or more of the following values.
Value | Description |
WMS_PLUGIN_NONE | The plug-in is not loaded. |
WMS_PLUGIN_ERROR | An error occurred in the plug-in. |
WMS_PLUGIN_LOADED | The plug-in was loaded. |
WMS_PLUGIN_ENABLED | The plug-in was enabled. |
WMS_PLUGIN_LOADED_IN_PROC | The plug-in was loaded into the client process. |
WMS_PLUGIN_LOADED_OUT_OF_PROC | The plug-in was loaded outside of the client process. |
WMS_PLUGIN_REMOVE_ON_SERVICE_RESTART | The plug-in will be removed when Windows Media Services is restarted. |
Return Values
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
Return code | Number | Description |
E_POINTER | 0x80004003 | pVal is a NULL pointer argument. |
Remarks
When the server starts, plug-ins that are not enabled have a status of WMS_PLUGIN_NONE. When you both load and enable a plug-in, the plug-in status is WMS_PLUGIN_LOADED & WMS_PLUGIN_ENABLED. If the plug-in fails after it has been loaded, the plug-in status is WMS_PLUGIN_LOADED & WMS_PLUGIN_ERROR. When you set the Enabled property to VARIANT_FALSE, the plug-in status is WMS_PLUGIN_LOADED.
When a plug-in error occurs, the Status property on the IWMSServer interface indicates that either a critical or non-critical error has occurred. For more information, see the IWMSServer::get_Status method.
Example Code
#include <windows.h> #include <atlbase.h> // Includes CComBSTR and CComVariant. #include "wmsserver.h" // Declare variables and interfaces. IWMSServer *pServer; IWMSPlugins *pPlugins; IWMSPlugin *pPlugin; HRESULT hr; CComVariant varIndex; CComBSTR bstrText; long lCount; long lValue; // 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; for (long x = 0; x < lCount; x++) { varIndex = x; hr = pPlugins->get_Item(varIndex, &pPlugin); if (FAILED(hr)) goto EXIT; // Retrieve the current status of the plug-in. hr = pPlugin->get_Status(&lValue); if (FAILED(hr)) goto EXIT; // Retrieve error information if the plug-in // is in error status. if (lValue & WMS_PLUGIN_ERROR) { hr = pPlugin->get_ErrorCode(&lValue); if (FAILED(hr)) goto EXIT; hr = pPlugin->get_ErrorText(&bstrText); if (FAILED(hr)) goto EXIT; } // Release temporary COM objects. pPlugin->Release(); } 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 |