DirectX--Filter属性页的调用 分类: DirectX 2014-12-18 08:49 422人阅读 评论(0) 收藏

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 @ 2014-12-18 08:49  毛毛虫的薄刻  阅读(209)  评论(0编辑  收藏  举报