Playing Video In Dialogs
-
In my MFC application, I create a series of 4 dialog windows all idential (an array of dialogs). Now I play a different video on each dialog on an Animate control. For Dialog 1 (index 0) - see code below:-
// Control of the video window facilities CAnimateCtrl m_screen; // Handle to the MCI window for playing video (.avi and .mpg) HWND hMCI[4] = {NULL, NULL, NULL, NULL}; hMCI[0] = MCIWndCreate(m_screen, AfxGetApp()->m_hInstance, MCIWNDF_SHOWALL | MCIWNDF_NOMENU | MCIWNDF_NOOPEN | MCIWNDF_NOPLAYBAR, "animation.mpg"); // PlayVideo(0); /* If the MCI video window has been activated the close it */ /* This is so it can be resized when restarted */ if(hMCI[index]) { MCIWndClose (hMCI[index]); m_MainText.ShowWindow (SW_SHOW); playVideo = true; displayed = false; m_screen.ShowWindow (SW_HIDE); } void CEmuDlg::PlayVideo(short index) { if(playVideo) { m_MainText.ShowWindow (SW_HIDE); m_screen.ShowWindow (SW_SHOW); // Arrange for the window to be maximised for the Animation control size stingray_animation.mpg ::ShowWindow(hMCI[index],SW_MAXIMIZE); // Play the video MCIWndPlay(hMCI[index]); /* Arrange for the video to be played repeatedly */ MCIWndSetRepeat(hMCI[index],TRUE); // Only works for actions on Menu Bar of the MCI playVideo = false; } else { // Hide the animation window MCIWndPause(hMCI[index]); //MCIWndStop(hMCI); //MCIWndClose(hMCI); m_screen.ShowWindow (SW_HIDE); playVideo = true; // Is the clear box checked? if(!m_pClear.GetCheck ()) m_MainText.ShowWindow (SW_SHOW); } }
Now the video only plays on a single dialog window. Do I need to do anything else to allow a different video play on dialog 3 say at the same time. Can I only play on video per application?