Click here to Skip to main content
14,774,693 members
Articles » Multimedia » Audio and Video » Audio
Posted 13 Jun 2001


128 bookmarked

A very simple MP3 Player

Rate me:
Please Sign up or sign in to vote.
4.62/5 (54 votes)
13 Jun 2001
A simple MP3/AVI player using the VFW32 library


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 :

  • Create a private variable HWND m_Video and BOOL Pause;

  • in the OnInitDialog set m_Video = NULL;

  • Put almost the Play button and add this source code on

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(),
	Pause = FALSE;

void CAVIPlayerDlg::OnPause() 
		Pause = FALSE;
		Pause = TRUE;

void CAVIPlayerDlg::OnCancel() 
	if(m_Video !=NULL)

void CAVIPlayerDlg::OnStop() 
	// TODO: Add your control notification handler code here
	if(m_Video !=NULL)

I Suggest you to refer to the MCI Reference on the net at

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

That's all for this !


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

United States United States
My name is BLaZe and I have 15 years old

Comments and Discussions

Generalm_Path Pin
loudawgg28-Apr-04 7:06
Memberloudawgg28-Apr-04 7:06 
Questionhow can i modify this to play in linux Pin
maheshkk6-Apr-04 20:54
Membermaheshkk6-Apr-04 20:54 
GeneralMMSYSTEM 296 ERROR while play mp3 file Pin
chuit5-Jan-04 11:28
Memberchuit5-Jan-04 11:28 
QuestionCan this Mp3player run on a DSP chipset ? Pin
Jiangcr8117-Nov-03 16:49
MemberJiangcr8117-Nov-03 16:49 
GeneralGood but want more ;-) Pin
BoscoW14-Jun-03 6:48
MemberBoscoW14-Jun-03 6:48 
GeneralRe: Good but want more ;-) Pin
electriac17-Nov-06 6:22
Memberelectriac17-Nov-06 6:22 
Generalurgent help!!!!!!!! Pin
athira28-May-03 22:54
Memberathira28-May-03 22:54 
Questionhow to detect end of song ? Pin
rmajda23-Apr-03 23:31
Memberrmajda23-Apr-03 23:31 
AnswerRe: how to detect end of song ? Pin
oqnet19-Apr-05 15:41
Memberoqnet19-Apr-05 15:41 
QuestionCan this mp3 player do real time decoding? Pin
fcfc13-Apr-03 23:56
Memberfcfc13-Apr-03 23:56 
AnswerRe: Can this mp3 player do real time decoding? Pin
DJWALSH14-Apr-03 3:31
MemberDJWALSH14-Apr-03 3:31 
GeneralRe: Can this mp3 player do real time decoding? Pin
shailesh4924-Jan-04 4:17
Membershailesh4924-Jan-04 4:17 
QuestionHow to size the AVI window Pin
tattalevieuxgrincheux9-Dec-02 18:53
Membertattalevieuxgrincheux9-Dec-02 18:53 
Generalexecute me Pin
NeverGrief27-Nov-02 5:57
MemberNeverGrief27-Nov-02 5:57 
GeneralGood and Simple Pin
Anonymous31-Aug-02 7:45
MemberAnonymous31-Aug-02 7:45 
GeneralRe: Good and Simple Pin
fanncy11-Sep-06 23:43
Memberfanncy11-Sep-06 23:43 
QuestionHow to loop continously?? Pin
Ramees28-Aug-02 3:57
MemberRamees28-Aug-02 3:57 
AnswerRe: How to loop continously?? Pin
Anonymous20-Oct-02 18:20
MemberAnonymous20-Oct-02 18:20 
GeneralRe: How to loop continously?? Pin
oqnet19-Apr-05 16:01
Memberoqnet19-Apr-05 16:01 
GeneralGreat Program Pin
sk-i-za7-Aug-02 8:38
susssk-i-za7-Aug-02 8:38 
GeneralHolds on to previous file Pin
codermallu1-Aug-02 4:58
Membercodermallu1-Aug-02 4:58 
GeneralRe: Holds on to previous file Pin
oqnet19-Apr-05 15:29
Memberoqnet19-Apr-05 15:29 
GeneralCodecs required Pin
Armen Hakobyan22-Jul-02 17:40
professionalArmen Hakobyan22-Jul-02 17:40 
Generalplay avi files in .net environment Pin
20-May-02 23:16
suss20-May-02 23:16 
GeneralChanging soundcards. Pin
Largie2-Mar-02 1:51
MemberLargie2-Mar-02 1:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.