在数组字符串中获取友好名称? [英] Get friendly names in an array string?

查看:66
本文介绍了在数组字符串中获取友好名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想以数组字符串的形式获取所有视频捕获设备的友好名称.我已经看到了一些示例,可以将它们放入comboBox或listBox中,但我不想这样做.我的编指的是选择捕获设备"(msdn)是正确的.而且我认为这很重要,即如何在c ++/win Forms应用程序的while循环中获取数组中的字符串.尽管我在网上进行了很多搜索,但无法获得有用的有用信息.

能否请你帮忙?

我的代码:

Hello,

I want to get the friendly names of all video capture devices in an array string. I''ve seen some examples to get them in a comboBox or a listBox, which I don''t want to do. My prog refers to "Selecting a Capture Device"(msdn) is right. And I think it''s the method, how to get the strings in an array in a while-loop under c++/win forms app, that matters. Altough I searched a lot in the net, I couldn''t get useful informations that helps.

Could you please help?

My Codes:

while (pClassEnum->Next(1, &pMoniker, &cFetched) == S_OK)
 {             
    hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag);
    if (FAILED(hr))
        {
            pMoniker->Release();
            return hr;  
        } 
    hr = pBag->Read(L"FriendlyName", &var, 0);

              if (SUCCEEDED(hr))
                {
 //String^ NAME = gcnew String(var.bstrVal);
 
// With only the line before, the friendly name can be gotten, but obviously only one because it's just a string. I've made a break point to see how the prog runs. And I saw the var.bstrVal has been built three times, that means the NAME I finally got is the last device name.

                    array <String^>^ NAME;

                    NAME[2] = gcnew String (var.bstrVal);// I have 3 webcams, I want their names to be saved in the array NAME[2].

                }
                VariantClear(&var);

        pBag->Release();
        pMoniker->Release();

  }


选择捕获设备:
http://msdn.microsoft.com/zh-CN /library/windows/desktop/dd377566(v=vs.85).aspx [


Selecting a Captur Device:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd377566(v=vs.85).aspx[^]

推荐答案


array = @(" .\ Business_Layer \ Java \ com \ saba \ learningoffering \ business \ power.java @@ \ main \ 2" . \ Business_Layer \ Java \ mil \ army \ dls \ ajax \ persist \ strong.java @@ \ main \ 4" .\ DB_Scripts \ DefectFixes \ cool.sql @@ \ main \ 1" ) for (
array=@(".\Business_Layer\Java\com\saba\client\contentinventory\great.java@@\main\1",".\Business_Layer\Java\com\saba\learningoffering\business\power.java@@\main\2",".\Business_Layer\Java\mil\army\dls\ajax\persist\strong.java@@\main\4",".\DB_Scripts\DefectFixes\cool.sql@@\main\1") for (


i = 0;
i=0;


这篇关于在数组字符串中获取友好名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆