用來產生目錄的 RunGraphAndWait 函式
下列函式是範例程式中的協助程式函式,會在 自動產生目錄中討論。
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;
}
相關主題