IWMSBasicPlugin::GetCustomAdminInterface

The server calls the GetCustomAdminInterface method to retrieve a pointer to the administration interface of a plug-in.

HRESULT GetCustomAdminInterface(
  IDispatch**  pValue
);

Arguments

pValue

[out] Pointer to a pointer to the IDispatch interface of the plug-in administration interface.

Return Value

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 IWMSEventLogIWMSEventLog 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

An administration interface enables you to specify and retrieve the properties of a plug-in. Typically, an administration interface is used in conjunction with MMC or ASP property pages. For more information, see Creating an MMC Property Page or Creating an ASP Property Page.

The server calls the GetCustomAdminInterface method when the plug-in is created and when the IWMSPlugin::get_CustomInterface method is called. The minimum implementation returns NULL.

Example

STDMETHODIMP CPlugin::GetCustomAdminInterface( IDispatch **ppValue )
{
    HRESULT hr = S_OK;
    *ppValue = NULL;

    // Check for a valid pointer.
    if ( ( NULL == ppValue ) )
    {
        return( E_POINTER );
    }
    
    // Initialize the administration interface. In this example, the 
    // class that implements the administration interface is derived 
    // from CComObjectRootEx.
    CComObject< CPluginAdmin > *spPluginAdmin;

    // Create an instance of the class that implements the administration
    // interface. 
    hr = CComObject< CPluginAdmin >::CreateInstance( &spPluginAdmin );

    if( SUCCEEDED( hr ) )
    {
        // Query for and return the IDispatch pointer to the 
        // administration interface.
        CComPtr< IDispatch > spAdmin( spPluginAdmin );
        hr = spPluginAdmin->QueryInterface( IID_IDispatch, (void **) ppValue );
    }

    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

Concepts

IWMSBasicPlugin Interface