directX根据设备类GUID查询所属的filter

hr = m_pSysDevEnum->CreateClassEnumerator(*clsid, &pEnumCat, 0);
    ASSERT(SUCCEEDED(hr));
    if FAILED(hr)
        return;

    // Enumerate all filters using the category enumerator
    hr = EnumFilters(pEnumCat);

IBaseFilter *buf[20];

HRESULT CSysEnumDlg::EnumFilters(IEnumMoniker *pEnumCat)
{
    HRESULT hr=S_OK;
    IMoniker *pMoniker;
    ULONG cFetched;
    VARIANT varName={0};
    int nFilters=0;
    IBaseFilter * pSrc = NULL;
    // Clear the current filter list
    ClearFilterList();

    // If there are no filters of a requested type, show default string
    if (!pEnumCat)
    {
        m_FilterList.AddString(TEXT("<< No entries >>"));
        SetNumFilters(nFilters);
        return S_FALSE;
    }

    // Enumerate all items associated with the moniker
    while(pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK)
    {
        IPropertyBag *pPropBag;
        ASSERT(pMoniker);

        // Associate moniker with a file
        hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, 
                                    (void **)&pPropBag);
        ASSERT(SUCCEEDED(hr));
        ASSERT(pPropBag);
        if (FAILED(hr))
            continue;

        // Read filter name from property bag
        varName.vt = VT_BSTR;
        hr = pPropBag->Read(L"FriendlyName", &varName, 0);
        if (FAILED(hr))
            continue;

        // Get filter name (converting BSTR name to a CString)
        CString str(varName.bstrVal);

/*

       if(hr == NOERROR)//根据名称检索filter
        {
CString str(varName.bstrVal);

if (str.Find("Virtual Camera",0)!=-1)
{
hr = pMoniker->BindToObject(0,0,IID_IBaseFilter, (void**)&pSrc);
if (FAILED(hr))
{
//  Msg(TEXT("Couldn't bind moniker to filter object!  hr=0x%x"), hr);
break;
}
break;
}

}

*/

        SysFreeString(varName.bstrVal);
        
//////////////////////////////////////////
        hr = pMoniker->BindToObject(0,0,IID_IBaseFilter, (void**)&pSrc);
if (FAILED(hr))
            AfxMessageBox(_T("err001"),MB_OK,NULL);
buf[nFilters] = pSrc;//保持当前的设备类的所有的filter
/////////////////////////////////////////////
nFilters++;
        // Read filter's CLSID from property bag.  This CLSID string will be
        // converted to a binary CLSID and passed to AddFilter(), which will
        // add the filter's name to the listbox and its CLSID to the listbox
        // item's DataPtr item.  When the user clicks on a filter name in
        // the listbox, we'll read the stored CLSID, convert it to a string,
        // and use it to find the filter's filename in the registry.
        VARIANT varFilterClsid;
        varFilterClsid.vt = VT_BSTR;

        // Read CLSID string from property bag
        hr = pPropBag->Read(L"CLSID", &varFilterClsid, 0);
        if(SUCCEEDED(hr))
        {
            CLSID clsidFilter;

            // Add filter name and CLSID to listbox
            if(CLSIDFromString(varFilterClsid.bstrVal, &clsidFilter) == S_OK)
            {
                AddFilter(str, &clsidFilter);
            }

            SysFreeString(varFilterClsid.bstrVal);
        }
       
        // Cleanup interfaces
        SAFE_RELEASE(pPropBag);
        SAFE_RELEASE(pMoniker);
    }

    // Update count of enumerated filters
    SetNumFilters(nFilters);
    return hr;
}

时间: 2024-10-07 12:15:43

directX根据设备类GUID查询所属的filter的相关文章

directX枚举系统设备类

void CSysEnumDlg::DisplayFullCategorySet(void){    USES_CONVERSION;     HRESULT hr;    IEnumMoniker *pEmCat = 0;    ICreateDevEnum *pCreateDevEnum = NULL;    int nClasses=0;     // Create an enumerator    hr = CoCreateInstance(CLSID_SystemDeviceEnum,

zf框架的db类select查询器join链表使用示例

 这篇文章主要介绍了zf框架的Db类select查询器join链表使用示例,需要的朋友可以参考下 zend框架的查询器join()链表使用示例    代码如下: <?php //引入Loader类(自动加载类) require_once("Zend/Loader.php"); //使用Loader类引入一个Db类 Zend_Loader::loadClass("Zend_Db"); //引入Zend_Db的状态器 Zend_Loader::loadClass(

mybatis生成的DAO MAPPER 实体类 没有查询全部 添加什么才能出来查询全部

问题描述 mybatis生成的DAO MAPPER 实体类 没有查询全部 添加什么才能出来查询全部 package com.bestteam.base.dao; import com.bestteam.base.entity.User; public interface UserMapper { int deleteByPrimaryKey(String id); int insert(User record); int insertSelective(User record); User se

shh项目错误-MyEclipse下生成持久化类,查询出错了

问题描述 MyEclipse下生成持久化类,查询出错了 java.lang.RuntimeException: org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; SQL [select user0_.userID as col_0_0_, user0_.userName as col_1_0_, user0_.userPassword as col_2_0_ from

jsp调用java类并查询sql数据库(1/2)

jsp教程调用java类并查询sql数据库教程 package bean; import java.sql.*; public class MyDb_Page{     private Statement stmt;     private Connection conn=null;     private ResultSet rs=null;     private String navi;         public void connection(String db_name,Strin

zf框架的db类select查询器join链表使用示例(zend框架)_php实例

zend框架的查询器join()链表使用示例 复制代码 代码如下: <?php//引入Loader类(自动加载类)require_once("Zend/Loader.php");//使用Loader类引入一个Db类Zend_Loader::loadClass("Zend_Db");//引入Zend_Db的状态器Zend_Loader::loadClass("Zend_Db_Statement_Pdo");//配置数据库连接信息$Config

ExtJs4 Model类关联查询问题

问题描述 现在有MyClass和Student两个Model类,代码如下:Ext.onReady(function(){//MyClassExt.define("MyClass",{extend:"Ext.data.Model",fields:[{name:"cid",type:"int"},{name:"cname",type:"string"}],proxy:{type:"

php操作xml类读取查询删除数据(支持三级节点)

文件名:xml.class.php  代码如下 复制代码 /*** * * * 文件名: xml.php * * 作 用: xml类,完善中,暂只支持三级节点 * * 作 者: loking(biyees) * * * * example 读取数据: * * $xml = new xml("dbase.xml",'table'); * * $data=$xml->xml_fetch_array(); * * echo "<pre style=\"font

求问一个关于SQL父子类编号查询语句的问题!

问题描述 一个表knocategory中有CODE和PCODE字段,CODE是子类编号,假如CODE是1001001,1001002,1001003这样的,那么PCODE就是1001.CODE是1001001001,那么PCODE就是1001001,要求查询出这张表中当PCODE和CODE相等时的CODE编号SQL语句咋写... 解决方案 解决方案二:...123有好心人吗.解决方案三:selectcodefromknocategorya,knocategorybwherea.code=b.co