0

我不明白如何使用菜单或列表来允许用户选择其适当的设备。有什么东西不见了。我不明白。你能启发我的思想吗?

void    fillDevices(HWND list)
{

IPropertyBag *tmpBag=NULL;
    tmpMonk->BindToStorage(0,0,IID_IPropertyBag,(void **)&tmpBag);
    VariantInit(&varName);
    //DevicePath-Description-FriendlyName
    checkIt(tmpBag->Read(L"FriendlyName",&varName,0));

// i need to fill it  with device names and be able to chose from the list 

    VariantClear(&varName);
    tmpBag->Release();

}
4

1 回答 1

1

Windows SDK AMCap 示例正是这样做的:

// put all installed video and audio devices in the menus
//
void AddDevicesToMenu()
{
// ...
    while(hr = pEm->Next(1, &pM, &cFetched), hr==S_OK)
    {
        IPropertyBag *pBag=0;

        hr = pM->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag);
        if(SUCCEEDED(hr))
        {
            VARIANT var;
            var.vt = VT_BSTR;
            hr = pBag->Read(L"FriendlyName", &var, NULL);
            if(hr == NOERROR)
            {
                AppendMenu(hMenuSub, MF_STRING, MENU_VDEVICE0 + uIndex,
                    var.bstrVal);
//...

Windows SDK 中的相对路径:\Samples\multimedia\directshow\capture\amcap

于 2012-08-22T16:37:52.747 回答