Microsoft DirectX 9.0

Generating the Complete Filter Graph

The following code fragment demonstrates how to generate the complete filter graph based on the multimedia source or stored filter graph. After creating an FilgraphManager object that is initially "empty," the application calls the FilgraphManager.RenderFile method to build up the complete graph.

' Start by creating a new, empty filter graph. 
Dim g_objMC as IMediaControl  ' from the General Declarations section ... 
Set g_objMC = New FilgraphManager  ' create the new filter graph 
' Use the common File Open dialog to let the user select the input file. 
CommonDialog1.ShowOpen  ' user selects a source or filter graph 
' call IMediaControl.RenderFile to add all filters and connect all pins.
g_objMC.RenderFile CommonDialog1.filename  ' Generates the complete graph.