一. 安装完Windows SDK 7.0或7.1后,在C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin下有32位的graphedt.exe,及x64目录下有64位版本的graphedt.exe,当使用任何一个版本不正常的行为时,换成另一个版本试试;
二. 在Win7下,GraphEdit的【Connect To Remote Graph】不好用时,解决的办法是注册:regsvr32 "C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\proppage.dll"(注意该dll也有x86和x64版本区分),可解决问题;
三. 调试DirectShow程序的时候,利GraphEdit查看自已程序中的Graph:
1.下面的这个函数是将我们的IGraphBuilder接口添加到GraphEdit中去.
HRESULT AddToRot(IUnknown *pUnkGraph, DWORD *pdwRegister)
{
IMoniker * pMoniker;
IRunningObjectTable *pROT;
if (FAILED(GetRunningObjectTable(0, &pROT))) {
return E_FAIL;
}
WCHAR wsz[256];
wsprintfW(wsz, L"FilterGraph %08x pid %08x", (DWORD_PTR)pUnkGraph, GetCurrentProcessId());
HRESULT hr = CreateItemMoniker(L"!", wsz, &pMoniker);
if (SUCCEEDED(hr)) {
hr = pROT->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE, pUnkGraph,
pMoniker, pdwRegister);
pMoniker->Release();
}
pROT->Release();
return hr;
}
2.下面的这个函数是从GraphEdit中移除我们的IGraphBuilder.
void RemoveFromRot(DWORD pdwRegister)
{
IRunningObjectTable *pROT;
if (SUCCEEDED(GetRunningObjectTable(0, &pROT))) {
pROT->Revoke(pdwRegister);
pROT->Release();
}
}
3.以上两个函数在程序的使用方法.
IGraphBuilder *pGraph;
DWORD dwRegister;
// Create the filter graph manager.
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGraph);
#ifdef _DEBUG
hr = AddToRot(pGraph, &dwRegister);
#endif
// Rest of the application (not shown).
#ifdef _DEBUG
RemoveFromRot(dwRegister);
#endif
pGraph->Release();
4.打开GraphEdit程序后,点击File菜单->Connect to Remote Graph或Ctrl+G出现一个选窗口点击确定就可以看到你程序中的Graph了!
四、其实不推荐使用微软的GraphEdit,还不如安装K-Lite Codec后,使用里面自带的GraphStudioNext.exe。网址:http://www.codecguide.com/