Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

yanuart

DShow problem

This topic is 5835 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

Sometimes my media/movie won''t show on the screen if I use Fullscreen Mode, but it worked fine if I used windowed mode. can somebody tell me why ?? This is the code that I use to play my media file :
void CGameApp:layFMV(const unsigned short *fname)
{

	IGraphBuilder *pGraph;
    IMediaControl *pMediaControl;
    IMediaEvent   *pEvent;
	IVideoWindow    *pVidWin = NULL;

    CoInitialize(NULL);
    ShowWindow( m_hWnd, SW_SHOWDEFAULT );
	HRESULT hr;		
    UpdateWindow( m_hWnd );
    // Create the filter graph manager and query for interfaces.
    CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, 
                        IID_IGraphBuilder, (void **)&pGraph);
    pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);
    pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
	pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVidWin);

    // Build the graph. IMPORTANT: Change string to a file  on your system.
    pGraph->RenderFile((const unsigned short*)fname, NULL);
	
	//Set the video window.
    pVidWin->put_Owner((OAHWND)m_hWnd);
    pVidWin->put_WindowStyle(WS_CHILD);

	pVidWin->put_Visible(OATRUE);
    RECT grc;
    GetClientRect(m_hWnd, &grc);
    pVidWin->SetWindowPosition(0, 0, grc.right, grc.bottom);

	long lEventCode=0x0000;
    long lParam1;
	long lParam2;

    // Run the graph.
    while(!(m_pDInput->GetAction()&BESCAPE)&&(lEventCode!=EC_COMPLETE))
	{
		pMediaControl->Run();
		pEvent->GetEvent(&lEventCode,&lParam1,&lParam2,100);
	}

	pMediaControl->Stop();
    // Wait for completion. 
   // long evCode;
    //pEvent->WaitForCompletion(INFINITE, &evCode);

    // Clean up.
    pVidWin->put_Visible(OAFALSE);
    pVidWin->put_Owner((OAHWND)m_hWnd);  
	pEvent->Release();
    pMediaControl->Release();
    pVidWin->Release();
    pGraph->Release();

} 
I hope it;s not too long, but it''s basically ripped from the docs.

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!