IWMSBasicPlugin::InitializePlugin
Previous | Next |
IWMSBasicPlugin::InitializePlugin
The server calls the InitializePlugin method to initialize a plug-in.
Syntax
HRESULT InitializePlugin( IWMSContext* pServerContext, IWMSNamedValues* pNamedValues, IWMSClassObject* pClassFactory );
Parameters
pServerContext
[in] Pointer to an IWMSContext interface containing the server context.
pNamedValues
[in] Pointer to an IWMSNamedValues interface containing a collection of properties for the plug-in. The properties can be specified initially during the registration process. For more information, see Registering Plug-in Properties. The properties appear in the server namespace and can be edited by using the IWMSNamedValue interface.
pClassFactory
[in] Pointer to an IWMSClassObject interface that the plug-in can use to create IWMSContext, IWMSCommandContext, IWMSPacket, and IWMSPacketList objects.
Return Values
If the method succeeds, the plug-in must return S_OK. To report an error, the plug-in can return any HRESULT other than S_OK. If the plug-in uses the IWMSEventLog interface to log error information directly to the Windows Event Viewer, it is recommended that it return NS_E_PLUGIN_ERROR_REPORTED. Typically, the server attempts to make plug-in error information available to the server object model, the Windows Event Viewer, and the troubleshooting list in the details pane of the Windows Media Services MMC. However, if the plug-in uses the IWMSEventLog interface to send custom error information to the Windows Event Viewer, returning NS_E_PLUGIN_ERROR_REPORTED stops the server from also logging to the event viewer. For more information about retrieving plug-in error information, see Identifying Plug-in Errors.
Remarks
The InitializePlugin method is implemented by the plug-in and called by the server. The server calls the method only when the plug-in is created. The minimum implementation is S_OK. The InitializePlugin and IWMSBasicPlugin::EnablePlugin methods must return S_OK before the server can successfully enable and use the plug-in. InitializePlugin is called before EnablePlugin.
Example Code
STDMETHODIMP CPlugin::InitializePlugin ( IWMSContext *pServerContext, IWMSNamedValues *pNamedValues, IWMSClassObject *pClassFactory ) { HRESULT hr = S_OK; // Check for NULL pointers. if ( ( NULL == pServerContext ) || ( NULL == pNamedValues ) || ( NULL == pClassFactory ) ) { return( E_INVALIDARG ); } // Retrieve a pointer to the IWMSServer interface from the // server context. hr = pServerContext->GetAndQueryIUnknownValue( const_cast<LPWSTR>( WMS_SERVER ), WMS_SERVER_ID, IID_IWMSServer, (IUnknown**) &m_pServer, 0 ); if( SUCCEEDED( hr ) ) { // TODO: Continue initializing the plug-in. } return( hr ); }
Requirements
Header: wmsbasicplugin.h.
Library: WMSServerTypeLib.dll.
Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.
See Also
- IWMSBasicPlugin Interface
- IWMSBasicPlugin::EnablePlugin
- IWMSCommandContext Interface
- IWMSContext Interface
- IWMSPacket Interface
- IWMSPacketList Interface
Previous | Next |