IMediaControl *pMC = NULL;
IVideoWindow *pVW = NULL;
...
JIF(pGB->QueryInterface(IID_IMediaControl, (void **)&pMC));
JIF(pGB->QueryInterface(IID_IVideoWindow, (void **)&pVW));//在这里没错
JIF(pVW->put_Owner((OAHWND)ghApp));//在这里就报一个框 如下
JIF(pVW->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN));
FAILED(hr=0x80004002) in pVW->put_Owner(OAHWND)ghApp)
请各位看看 问题应该出在那?
IVideoWindow *pVW = NULL;
...
JIF(pGB->QueryInterface(IID_IMediaControl, (void **)&pMC));
JIF(pGB->QueryInterface(IID_IVideoWindow, (void **)&pVW));//在这里没错
JIF(pVW->put_Owner((OAHWND)ghApp));//在这里就报一个框 如下
JIF(pVW->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN));
FAILED(hr=0x80004002) in pVW->put_Owner(OAHWND)ghApp)
请各位看看 问题应该出在那?
解决方案 »
- 问个比较简单的问题有关vs2008的
- UTF8格式的网页如何解析?
- CList的嵌套使用
- CPropertyPage::OnWizardNext()怎样跳到任意的页?
- 请问如何把两个jpg文件左右叠加成一个新的jpg文件?
- 散分20,~~~~~~~~~~~~~~~~~~~~回答正确者即得分。
- 用VC如何根据用户输入的表达式在屏幕上画出函数曲线图呢?
- 如何调用和显示其它程序?
- 我照着书上的例子写了个ODBC数据库程序(MFC),但我每次执行时都要我选数据库文件?
- 请问用createfile这个API函数打开硬盘上一个已存在的文件,文件名这个参数应该是什么格式的?
- C++ bmp旋转任意角度 但是不清晰。
- html 转 图片
这是全部的错误提示?
没这样的接口ghApp的类型?
pVW->put_Owner(OAHWND)ghApp)//ghApp是窗口句柄吗??参数为窗口句柄
是!HWND ghApp=0;是窗口句柄
要不给一个及时的联系方式 我的qq 349394761 msn:[email protected]
各位大侠有什么想法随时告诉我!
2。既然JIF(pVW->put_Owner((OAHWND)ghApp));这句出了问题,就不要使用定义的那个宏了,直接使用hr = pVW->put_Owner((OAHWND)ghApp)。看pVW值?看ghApp值?最后看hr值?估计要么是ghApp值不对,要么是未连接render filter
那,问个问题:
为什么其它的例子没有出错,而这个例子却错了呢?我的结论是,楼主没找到关键点
呵呵 不是这个例子出错了 是我添加了我的帖子里边的代码出的错!
HWND ghApp=0;//在winmain里边创建的窗口 而且在没有添加我的代码的时候没错
HMENU ghMenu=0;
HINSTANCE ghInst=0;
TCHAR g_szFileName[MAX_PATH]={0};
DWORD g_dwGraphRegister=0;
RECT g_rcDest={0};// DirectShow interfaces
IGraphBuilder *pGB = NULL;
IMediaControl *pMC = NULL;
IMediaEventEx *pME = NULL;
IMediaSeeking *pMS = NULL;
IVMRWindowlessControl9 *pWC = NULL;
IVideoWindow *pVW = NULL; //这个是本人添加的 因为全屏要用到IVideoWindow 中的方法put_FullScreenModeHRESULT PlayMovieInWindow(LPTSTR szFile)
{
USES_CONVERSION;
WCHAR wFile[MAX_PATH];
HRESULT hr; // Check input string
if (szFile == NULL)
return E_POINTER; // Clear open dialog remnants before calling RenderFile()
UpdateWindow(ghApp); // Convert filename to wide character string
wcsncpy(wFile, T2W(szFile), NUMELMS(wFile)-1);
wFile[MAX_PATH-1] = 0; // Get the interface for DirectShow's GraphBuilder
JIF(CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGB)); if(SUCCEEDED(hr))
{
CComPtr <IBaseFilter> pVmr; // Create the Video Mixing Renderer and add it to the graph
JIF(InitializeWindowlessVMR(&pVmr)); // Render the file programmatically to use the VMR9 as renderer.
// We pass a pointer to the VMR9 so that it will be used as the
// video renderer. Pass TRUE to create an audio renderer also.
if (FAILED(hr = RenderFileToVMR9(pGB, wFile, pVmr, TRUE)))
return hr; // QueryInterface for DirectShow interfaces
JIF(pGB->QueryInterface(IID_IMediaControl, (void **)&pMC));
JIF(pGB->QueryInterface(IID_IMediaEventEx, (void **)&pME));
JIF(pGB->QueryInterface(IID_IMediaSeeking, (void **)&pMS));
JIF(pGB->QueryInterface(IID_IVideoWindow, (void **)&pVW));//这个地方是我添加的 目的是取到pVW实例 //全屏需要对象,所以接下来这么做
JIF(pVW->put_Owner((OAHWND)ghApp));
JIF(pVW->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN));//按理说这样就应该能调用pVW中的方法了 但是就是不行!哎
// Is this an audio-only file (no video component)?
if (CheckVideoVisibility())
{
JIF(InitVideoWindow(1, 1));
}
else
{
// This sample requires a video clip to be loaded
Msg(TEXT("This sample requires media with a video component. ")
TEXT("Please select another file."));
return E_FAIL;
} // Have the graph signal event via window callbacks for performance
JIF(pME->SetNotifyWindow((OAHWND)ghApp, WM_GRAPHNOTIFY, 0)); // Select a text font if not already set
if (!g_hFont)
g_hFont = SetTextFont(FALSE); // Don't display the Font Select dialog // Add the dynamic text bitmap to the VMR's input
// If the initial blend fails, post a close message to exit the app
hr = BlendText(ghApp, g_szAppText);
if (FAILED(hr))
PostMessage(ghApp, WM_CLOSE, 0, 0); // Complete the window setup
ShowWindow(ghApp, SW_SHOWNORMAL);
UpdateWindow(ghApp);
SetForegroundWindow(ghApp);
SetFocus(ghApp);#ifdef REGISTER_FILTERGRAPH
if (FAILED(AddGraphToRot(pGB, &g_dwGraphRegister)))
{
Msg(TEXT("Failed to register filter graph with ROT!\0"));
g_dwGraphRegister = 0;
}
#endif // Run the graph to play the media file
JIF(pMC->Run()); // Start the text update timer
StartTimer();
} return hr;
}
如果不是这个的话,就是我没理解您的意思!菜鸟一个 请各位担待
谢谢您的回答!如果我帖子中的方法解决不了问题 那也只有按这种方法来做了!
初步想法是: 在字幕的例子当中已经实现了响应窗口move或size的MoveVideoWindow 我直接创建屏幕大小的窗口 在上边播放
它query的是Video Render,不能控制vmr7或vmr9
来和窗口关联
我不是用想关联窗口 是为了用那个类中全屏功能所以不得以呀!
有用,在MoveVideoWindow就有这个函数的调用!
可能是用IVideoWindow的时候有什么我没有注意
的论坛上发了消息来问。大多数人的回答都是上面的一样。既然例子行运行你不能那么你肯定错了。
而且纠缠于hWndApp是不是错了之类的。
我想详细的说一下。
ms的例子中。能全屏的只有一个playwnd它并没有指定renderer是vmr9,其他例子中都不能全屏。还在说hWndApp不对或者楼主没有认真看代码的人请自己回去打嘴巴。 我把它的graph以调试的方式进行注册之后在graphedit里看到的是
vmr7我在自己的程序中使用了windowless模式。文档上说。windowsless模式高效。那么我推断默认vmr9是windowless模式。需要指定窗口才行
所以我推断vmr9 windowless已经不再支持IVideoWindow了