| Microsoft DirectX 8.1 (C++) | 
The SetFilterGraph method specifies the event sink for stream control events.
Syntax
void SetFilterGraph(
    IMediaEventSink *pSink
);
Parameters
pSink
Pointer to the Filter Graph Manager's IMediaEventSink interface, or NULL when the filter leaves the filter graph.
Return Values
This method does not return a value.
Remarks
Call this method from inside the filter's IBaseFilter::JoinFilterGraph method. The CBaseStreamControl class uses the IMediaEventSink interface to send EC_STREAM_CONTROL_STARTED and EC_STREAM_CONTROL_STOPPED events.
If your filter derives from CBaseFilter, first call the CBaseFilter::JoinFilterGraph method, which sets the CBaseFilter::m_pSink member variable. Then pass m_pSink to the SetFilterGraph method. Note that m_pSink is NULL when the filter leaves the graph, which is correct.
Example Code
STDMETHODIMP CMyFilter::JoinFilterGraph(IFilterGraph * pGraph, LPCWSTR pName)
{
    HRESULT hr = CBaseFilter::JoinFilterGraph(pGraph, pName);
    if (SUCCEEDED(hr)) 
    {
        m_pMyPin->SetFilterGraph(m_pSink);
    }
    return hr;
}
See Also