Step 3. Support QueryInterface

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

  • Include the DECLARE_IUNKNOWN macro in the public declaration section of your filter:
    
    
    public:
        DECLARE_IUNKNOWN;
    
    
    
  • Override CUnknown::NonDelegatingQueryInterface to check for the IIDs of the two interfaces:
    
    
    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.

Related topics

Creating a Filter Property Page
How to Implement IUnknown

 

 

Show: