Jump to content
  • Advertisement
Sign in to follow this  

DirectShow VideoWindow

This topic is 4267 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Im having trouble running a video in my own window, I pinned the problem down to the call put_Owner(), it fails every time with an error VFW_E_NOT_CONNECTED im trying to run all the functions from a class, maybe thats the problem, heres some source


	CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void**)&graphBuilder);

	if(FAILED(graphBuilder->QueryInterface(IID_IMediaControl, (void **)&mediaControl)))
		MB_INFO("Query Interface Media Control Failed");
	if(FAILED(graphBuilder->QueryInterface (IID_IMediaEvent, (void **)&mediaEvent)))
			MB_INFO("Query Interface Media Event Failed");

	if(FAILED(graphBuilder->QueryInterface (IID_IVideoWindow, (void **)&videoWindow)))
			MB_INFO("Query Interface Video Window Failed");


void VideoPlayback::SetVideoWindow(HWND * wnd)
	mainWindow = wnd;

	// The first call is to put_Owner, here we are telling DirectShow to use our main Window which we have the handle for 
	// (hWnd is a handle to a window and is returned when we call CreateWindow. For further info see: WinMain).
	if(FAILED( hr = videoWindow->put_Owner((OAHWND)*wnd)))
		MB_INFO("put_Owner failed");
			MB_INFO("Not Connected");

	GetWindowInfo(wnd, &info);

	// DirectShow needs to know this information so it can correctly calculate where to position 
	// the video e.g. avoid drawing over the menu bar.
		MB_INFO("put_Windowstyle failed");

	RECT clientRect;

	GetClientRect(wnd, &clientRect);

	if(FAILED(videoWindow->SetWindowPosition(clientRect.left, clientRect.top, clientRect.right, clientRect.bottom)))
		MB_INFO("SetWindowPosition failed");

	//if(FAILED(mediaEvent->SetNotifyWindow((OAHWND)wnd, WM_GRAPHNOTIFY, 0)))
	//	MB_INFO("SetNotifyWindow failed");

I really need help since there are almost no good tutorials on DirectShow (by the way if anyone knows any good ones, please post them up) Thanks

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!