继续调查embedded WindowsMediaPlayer problem,我试图通过DirectShow进程内服务器进行简单的文件回放:
::CoInitializeEx(0, COINIT_MULTITHREADED);
CComPtr<IGraphBuilder> spGraph;
spGraph.CoCreateInstance(CLSID_FilterGraph, 0, CLSCTX_INPROC_SERVER);
CComQIPtr<IMediaControl> spMediaControl(spGraph);
// ... later:
spGraph->RenderFile(L"c:\\foo.wav", 0); // fails with VFW_E_BAD_KEY
spMediaControl->Run();
有趣的是,在独立应用程序中进行测试时,我在测试的两个系统(Windows XP 32&amp; x64)上运行良好。 然而,它在我的真实用例中失败了,这是一个基于NPAPI的浏览器插件 - 即加载到Firefox / Chrome / Opera中的DLL。
有没有人知道这里会出现什么问题?
还有关于还有什么可以尝试的想法?
更新:也在Microsoft forums上询问。
UPDATE2:
IGraphBuilder::AddSourceFilter(path,path,&base)
已经因以下注册表调用而失败(如进程监视器中所示):
"RegOpenKey","HKCU\Software\Classes\c","NAME NOT FOUND","Desired Access: Query Value, Maximum Allowed" "RegOpenKey","HKCU\Software\Classes\Media Type\Extensions\.wav","NAME NOT FOUND","Desired Access: Read" "RegOpenKey","HKCU\Software\Classes\Media Type","NAME NOT FOUND","Desired Access: Read"