Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Media Control Interface 1

Status
Not open for further replies.

sweep123

Technical User
May 1, 2003
185
GB
I have arranges a video clip to be played in my MFC application, a sort of screen saver.

However I would like it to play over and over again?

Code so far:

hMCI = MCIWndCreate(m_screen, AfxGetApp()->m_hInstance, MCIWNDF_SHOWALL | MCIWNDF_NOMENU | MCIWNDF_NOOPEN | MCIWNDF_NOPLAYBAR, szPath);

MCIWndPlay(hMCI); // Button starts the clip

I can pause the clip by

MCIWndPause(hMCI); // Again via a button

But how do you determine if have reached the end and arrange for a start the clip again?

 
Try using:

VOID MCIWndSetRepeat(hwnd,f);

Parameters:
- hwnd
Handle of the MCIWnd window.
- f
New state of the repeat flag. Specify TRUE to turn on continuous playback.
 
OK I place the call to MCIWndSetRepeat just before I do MCIPlay, but the video clip stops at the end; i.e. it does not repeat.

 
I apologise for not posting this:

"Currently, MCIAVI is the only device that supports continuous playback." (taken from MSDN Feb. 2003). So it is useful only in case you are playing back an .AVI file.

On the other hand, there is a couple of MCI messages that you might find helpful:

1) MCIWNDM_GETPOSITION - retrieves the numerical value of the current position within the content of the MCI device.

2) MCIWNDM_NOTIFYMEDIA - notifies the parent window of an application that the media has changed. For the second parameter of this message, if the media is closing, it specifies a null string. So you could use this to get notified by a MCI device when the media is closing, and re-start playback. You can enable notification of media changes by specifying the MCIWNDF_NOTIFYMEDIA window style.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top