共用方式為


Step 3. Support QueryInterface

 
Microsoft DirectShow 9.0

Step 3. Support QueryInterface

To expose the filter's new interfaces to clients, do the following: 

STDMETHODIMP CGrayFilter::NonDelegatingQueryInterface(REFIID riid, void **ppv)
{
    if (riid == IID_ISpecifyPropertyPages)
    {
        return GetInterface(
           static_cast<ISpecifyPropertyPages*>(this),
           ppv);
    }
    else if (riid == IID_ISaturation)
    {
        return GetInterface(static_cast<ISaturation*>(this), ppv);
    }
    else
    {
        // Call the parent class.
        return CBaseFilter::NonDelegatingQueryInterface(riid, ppv);

        // NOTE: This example assumes that the filter inherits directly
        // from CBaseFilter. If your filter inherits from another class,
        // call the NonDelegatingQueryInterface method of that class.
    }
}

Next: Step 4. Create the Property Page.

See Also