在WinCE上用MFC对话框做个最简单的播放器,想用static text做播放窗口,但put_owner一直不成功,请问要怎样指定播放窗口?
部分代码:
IGraphBuilder *pGraph = NULL;
IMediaControl *pControl = NULL;
IMediaEvent *pEvent = NULL;
// Initialize the COM library.
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
printf("ERROR - Could not initialize COM library");
return;
}
// Create the filter graph manager and query for interfaces.
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGraph);
if (FAILED(hr))
{
printf("ERROR - Could not create the Filter Graph Manager.");
return;
}
hr = pGraph->RenderFile(L"\\NAND\\123.flv", NULL);
hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
CWnd* pVideoWnd=GetDlgItem(IDC_VIDEO_WND);//IDC_VIDEO_WND是static text控件的ID
IVideoWindow* pWnd = NULL;
hr = pGraph->QueryInterface(IID_IVideoWindow,(void**)&pWnd);
hr = pWnd->put_Owner((OAHWND)pVideoWnd->m_hWnd); //问题在这里,hr!=S_OK,返回80004002
pWnd->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);
CRect rc;
GetClientRect(&rc);
pWnd->SetWindowPosition(rc.left,rc.top,rc.Width(),rc.Height());