Schritt 3: Unterstützung von QueryInterface

Gehen Sie wie folgt vor, um die neuen Schnittstellen des Filters für Clients verfügbar zu machen:

  • Schließen Sie das DECLARE _ IUNKNOWN-Makro in den Öffentlichen Deklarationsabschnitt Ihres Filters ein:

    public:
        DECLARE_IUNKNOWN;
    
  • Überschreiben Sie CUnknown::NonDelegatingQueryInterface, um nach den IIDs der beiden Schnittstellen zu suchen:

    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.
        }
    }
    

Weiter: Schritt 4. Erstellen Sie die Eigenschaftenseite.

Erstellen einer Filtereigenschaftenseite

Implementieren von IUnknown