Unregistering a Filter

 
Microsoft DirectShow 9.0

Unregistering a Filter

To unregister a filter, implement the DllUnregisterServer function. Within this function, call the DirectShow AMovieDllRegisterServer2 function with a value of FALSE. If you called IFilterMapper2::RegisterFilter when you registered the filter, call the IFilterMapper2::UnregisterFilter method here.

The following example shows how to unregister a filter:

STDAPI DllUnregisterServer()
{
    HRESULT hr;
    IFilterMapper2 *pFM2 = NULL;

    hr = AMovieDllRegisterServer2(FALSE);
    if (FAILED(hr))
        return hr;
 
    hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
            IID_IFilterMapper2, (void **)&pFM2);

    if (FAILED(hr))
        return hr;

    hr = pFM2->UnregisterFilter(&CLSID_VideoCompressorCategory, 
            g_wszName, CLSID_SomeFilter);

    pFM2->Release();
    return hr;
}