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-12-18 20:37:26

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, NULL, C

Windows Azure Table Storage 解决 Guid 查询问题

在使用 Windows Azure Table Storage 的 CloudTableClient 对Azure 进行数据查询时,会发现在自定义类的Guid类型始终无法去成功查询出数据,对比发现 Guid 值是一致的,最初代码如下: public UserEntity GetUserByToken(string token) { var table = AzureTableContext.CloudTableClientContext.GetTableReference(UserEntity.

设备类class理解

http://blog.chinaunix.net/uid-20729583-id-1884552.html 设备类struct class一个类是一个设备的高级视图,它抽象出低级的实现细节.例如,驱动可以见到一个SCSI磁盘或者一个ATA磁盘,在类的级别,他们都是磁盘,类允许用户空间基于它们作什么来使用设备,而不是它们如何被连接或者它们如何工作. 设备类表示一类设备,所有的class对象都属于class_subsys子系统struct class{    const char *name;//

常用设备接口类GUID

转载:http://blog.csdn.net/jhqin/article/details/6775321 注意:在VC中使用这些常量名称时,除了包含相应的头文件外,还需要预先包含initguid.h头文件.即: [cpp] view plaincopy #include <initguid.h> 常用设备接口类GUID Identifier Class GUID Header GUID_DEVINTERFACE_USB_DEVICE {A5DCBF10-6530-11D2-901F-00C0

[BLE--HID]USB HID设备类定义

简述 HID设备,即人机交互设备,常见的有鼠标,键盘,游戏手柄,等等.一般有线方式都是通过USB连线连接到机器设备,作为用户输入设备.在蓝牙技术中,HID设备的接入就是无线的了.不过HID的相关定义当然还是一样的,不然设备驱动,兼容等问题都会有很多麻烦了.蓝牙中有HID, HOGP profile,但是只是在蓝牙数据通信上做的规范,HID具体含义相关,还是需要看USB相关的HID文档. USB设备类? USB设备可以在启动时,或者是在之后的连接状态下,都能够被主机进行配置.USB设备种类是非常多

Xamarin开发笔记—设备类&amp;第三方弹窗的使用和注意事项

一.设备类是Xamarin重要开发组成部分,下面介绍一下设备类的主要用法: //唤醒打电话 Device.OpenUri(new Uri("tel:180xxxxxxxx")); //打开网页 Device.OpenUri(new Uri("http://vipstone.cnblogs.com/")); //判断当前运行平台 Device.RuntimePlatform => Device.iOS, Device.Android, Device.WinPho

Java编译时根据调用该方法的类或对象所属的类决定

class Base{ ????int x = 1; ????static int y = 2; } class Subclass extends Base{ ????int x = 4; ????int y = 5; } public class Test02{ ????public static void main(String[] args){ ????????Subclass s = new Subclass(); ????????System.out.println(s.x+" &qu

移动设备类

<?php /** * MIT License * =========== * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, incl

Qt+QGIS二次开发:自定义类实现查询矢量数据的属性字段值(图查属性)

在GIS领域,有两种重要的查询操作,图查属性和属性查图. 本文主要介绍如何在QGIS中通过从QgsMapToolIdentify中派生自定义类实现查询矢量数据的属性字段值(图查属性). 重点参考资料: 1.QGis二次开发基础 -- 属性识别工具的实现 2.QGis(三)查询矢量图层的要素属性字段值 原文地址:https://www.cnblogs.com/rainbow70626/p/10383034.html