RunGraphAndWait Function for Generating a Table of Contents
The following function is a helper function in an example program that is discussed in Generating a Table of Contents Automatically.
HRESULT RunGraphAndWait(IGraphBuilder* pGraph)
{
IMediaControl* pControl = NULL;
HRESULT hr = pGraph->QueryInterface(IID_IMediaControl, (VOID**)&pControl);
if(SUCCEEDED(hr))
{
hr = pControl->Run();
if(SUCCEEDED(hr))
{
IMediaEvent* pEvent = NULL;
hr = pControl->QueryInterface(IID_IMediaEvent, (VOID**)&pEvent);
if(SUCCEEDED(hr))
{
long eventCode = 0;
hr = pEvent->WaitForCompletion(INFINITE, &eventCode);
pEvent->Release();
pEvent = NULL;
}
}
pControl->Release();
pControl = NULL;
}
return hr;
}
See Also
Generating a Table of Contents Automatically
Send comments about this topic to Microsoft
Build date: 4/7/2010