DirectX--Filter属性页的调用

IEnumFilters* pEnum;
HRESULT hr ;
if (pigb)
{
hr = pigb-> EnumFilters(&pEnum);
if (FAILED(hr)) 
{
return ;
}

     

IBaseFilter* pFilter = NULL;
while (pEnum->Next(1, &pFilter, NULL) == S_OK) 
{
// Check for required interface
IUnknown* pUnk;//查找Filter接口,仅仅有一个?
HRESULT hrQuery = pFilter->QueryInterface(IID_IVideoWindow, (void**)&pUnk);
if (SUCCEEDED(hrQuery)) 
{
pUnk->Release();
pEnum->Release();
break ;
}
// pFilter->Release();
}
 //  pEnum->Release();
//
ISpecifyPropertyPages *pProp = NULL;//查询接口
hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pProp);
if (SUCCEEDED(hr)) 
{
// Get the filter's name and IUnknown pointer.
FILTER_INFO FilterInfo;
hr = pFilter->QueryFilterInfo(&FilterInfo); 
IUnknown *pFilterUnk;
pFilter->QueryInterface(IID_IUnknown, (void **)&pFilterUnk);
//
CString str(FilterInfo.achName);//显示Filter名称
MessageBox(str);

// Show the page. 
CAUUID caGUID;

pProp->GetPages(&caGUID);
pProp->Release();
OleCreatePropertyFrame(
this->GetSafeHwnd(),                   // Parent window
0, 0,                                 // Reserved
FilterInfo.achName,     //L"MAOMAO" // Caption for the dialog box 
1,                      // Number of objects (just the filter)
&pFilterUnk,            // Array of object pointers. 
caGUID.cElems,          // Number of property pages
caGUID.pElems,          // Array of property page CLSIDs
0,                      // Locale identifier
0, NULL                 // Reserved
);

// Clean up.
pFilterUnk->Release();
FilterInfo.pGraph->Release(); 
CoTaskMemFree(caGUID.pElems);
}
}

posted on 2017-06-04 21:19  yjbjingcha  阅读(288)  评论(0编辑  收藏  举报

导航