Skip to main content
Email Password   helpLost your password?

Introduction

I made a little sample program that enables you to play MP3 files without needing the AUDIOX library. I used the Windows Library VFW32.Lib

Just put the VFW32.lib in the Linker's space (Alt +F7) and add

#include "vfw.h"

to your principal file.

Once you've done this, you just need to use the MCI commands:

Steps :

Here are the functions I use in my dialog class to play/pause/resume and stop video playback.

m_Play is the 'Play' button control, m_Pause is the pause/resume button, Pause is a boolean value, and m_Video is a HWND.

void CAVIPlayerDlg::OnPlay() 
{
	m_Video = NULL;
	
	if(m_Video == NULL)
	{
		m_Video = MCIWndCreate(this->GetSafeHwnd(),
			AfxGetInstanceHandle(),
			WS_CHILD | WS_VISIBLE|MCIWNDF_NOMENU,m_Path);
		
	}
	else
	{
		MCIWndHome(m_Video);
	}
	
	MCIWndPlay(m_Video);
	Pause = FALSE;
	m_Play.EnableWindow(FALSE);
	
}

void CAVIPlayerDlg::OnPause() 
{
	if(Pause)
	{
		m_Pause.SetWindowText("Pause");
		MCIWndResume(m_Video);
		Pause = FALSE;
	}
	else
	{
		m_Pause.SetWindowText("Resume");
		MCIWndPause(m_Video);
		Pause = TRUE;
	}
}

void CAVIPlayerDlg::OnCancel() 
{
	if(m_Video !=NULL)
	{
		MCIWndDestroy(m_Video);
		OnOK();
	}
	CDialog::OnCancel();
}

void CAVIPlayerDlg::OnStop() 
{
	// TODO: Add your control notification handler code here

	MCIWndStop(m_Video);
	if(m_Video !=NULL)
	{
		MCIWndDestroy(m_Video);
	}
	m_Play.EnableWindow(TRUE);
}

I Suggest you to refer to the MCI Reference on the net at http://msdn.microsoft.com/library/psdk/multimed/mciwnd_3stv.htm

I also include an AVI player in this program. :-)

That's all for this !

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralSplitting a video file Pin
Vedavyasaachar
1:19 19 Aug '09  
Generaldownloading code Pin
mohammadarshad27
20:11 9 Apr '08  
GeneralPlaying the file through buffer Pin
nitin_pro
0:21 31 Oct '07  
QuestionPlaying the MP3 file through buffer Pin
nitin_pro
2:39 22 Oct '07  
Generalit is just cool [modified] Pin
jacej
6:40 27 Jul '07  
GeneralThis cool! Pin
earth_cg
7:54 8 Mar '07  
GeneralCan not play AVI Pin
psamir
21:59 9 Oct '06  
GeneralMCI Error Pin
naraimha
3:58 4 Oct '06  
GeneralCan this program play WAV? Pin
Aki Wang
0:55 3 Aug '06  
GeneralRe: Can this program play WAV? Pin
Aki Wang
1:29 3 Aug '06  
GeneralAL Pin
vnsr
5:00 8 Jun '06  
QuestionProblems Pin
nepobunceno
14:42 18 Apr '06  
Generalhow to play the mp3 song in the required output device, is there any function to specify the output device id for mp3 Pin
Farooq kotwal
2:05 22 Jun '05  
GeneralResolving Building Errors Pin
RobertOls1974
7:15 6 May '05  
GeneralRe: Resolving Building Errors Pin
Anonymous
5:36 30 Jun '05  
GeneralImplementing the progressbar Pin
retgrr34t
3:57 15 Apr '05  
GeneralAdding a volume button Pin
SaraMalkaW
16:05 9 Jan '05  
GeneralRe: Adding a volume button Pin
Anonymous
5:19 30 Jun '05  
GeneralHide Slider Control Pin
jun___
21:56 2 Dec '04  
GeneralRe: Hide Slider Control Pin
silufear
16:51 15 Jun '07  
Generalm_Path Pin
loudawgg
7:06 28 Apr '04  
Generalhow can i modify this to play in linux Pin
maheshkk
20:54 6 Apr '04  
GeneralMMSYSTEM 296 ERROR while play mp3 file Pin
chuit
11:28 5 Jan '04  
GeneralCan this Mp3player run on a DSP chipset ? Pin
Jiangcr81
16:49 17 Nov '03  
GeneralGood but want more ;-) Pin
BoscoW
6:48 14 Jun '03  


Last Updated 13 Jun 2001 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009