我无法理解如何使用菜单或列表来允许用户选择其适当的设备。 有些东西不见了。我不明白。你能说出我的想法吗?
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();
}
答案 0 :(得分:1)
Windows SDK AMCap sample正是这样做的:
// 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