Microsoft DirectX 8.0

Previewing a Project

To preview a project, create an instance of the basic render engine by calling the CoCreateInstance function. The class identifier is CLSID_RenderEngine. Then call the following methods on the render engine's IRenderEngine interface:

The following code example shows these steps.

IRenderEngine *pRender = NULL; 
hr = CoCreateInstance(CLSID_RenderEngine, NULL, 
    CLSCTX_INPROC_SERVER, IID_IRenderEngine, (void**) &pRender);

hr = pRender->SetTimelineObject(pTL);
hr = pRender->ConnectFrontEnd( );
hr = pRender->RenderOutputPins( );

Now you can run the filter graph. Obtain a pointer to the graph by calling the IRenderEngine::GetFilterGraph method. Query the graph for the IMediaControl interface and call IMediaControl::Run, as show in the following code example.

IGraphBuilder   *pGraph = NULL;
IMediaControl   *pControl = NULL;

hr = pRender->GetFilterGraph(&pGraph);
hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
hr = pControl->Run();

For a complete example that loads and previews a project file, see Loading and Previewing a Project.