[與此頁面相關聯的功能,DirectShow是舊版功能。 它已被 MediaPlayer、IMFMediaEngine、以及媒體基金會中的音訊/視訊擷取 取代。 這些功能已針對 Windows 10 和 Windows 11 進行優化。 Microsoft強烈建議新程式代碼盡可能在媒體 基礎中使用 MediaPlayer、IMFMediaEngine 和 音訊/視訊擷取,而不是 DirectShow。 Microsoft建議使用舊版 API 的現有程式代碼,盡可能改寫成使用新的 API。]
若要向客戶端公開篩選的新介面,請執行下列動作:
將 DECLARE_IUNKNOWN 巨集包含在您的過濾器的公用宣告區段中:
public: DECLARE_IUNKNOWN;
覆寫 CUnknown::NonDelegatingQueryInterface 來檢查兩個介面的 IID:
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. } }
下一步:步驟 4。建立屬性頁。
相關主題