Microsoft DirectX 8.1 (C++)

Step 1. Create the Required Components

The first step is to create the Filter Graph Manager and the Capture Graph Builder. Then call ICaptureGraphBuilder2::SetFiltergraph to associate the filter graph with the capture graph builder. The following code example shows these steps:

IGraphBuilder *pGraph = NULL;
ICaptureGraphBuilder2 *pBuilder = NULL;

// Create the Filter Graph Manager.
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
    IID_IGraphBuilder, (void **)&pGraph);

// Create the Capture Graph Builder.
CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC, 
    IID_ICaptureGraphBuilder2, (void **)&pBuilder);

// Associate the graph with the builder.
pBuilder->SetFiltergraph(pGraph);