Click here to Skip to main content
13,292,718 members (63,843 online)
Click here to Skip to main content
Add your own
alternative version


127 bookmarked
Posted 13 Jun 2001

A very simple MP3 Player

, 13 Jun 2001
Rate this:
Please Sign up or sign in to vote.
A simple MP3/AVI player using the VFW32 library
<!-- Download Links --> <!-- Main HTML starts here -->


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

You may also be interested in...

Comments and Discussions

QuestionDownload not working Pin
Member 1082473316-May-14 20:31
memberMember 1082473316-May-14 20:31 
QuestionDownload Problem Pin
abdkayali30-Nov-13 1:30
memberabdkayali30-Nov-13 1:30 
Questionerror on "MCIWndCreate" Pin
Mahdi Nejadsahebi30-Jun-12 2:17
memberMahdi Nejadsahebi30-Jun-12 2:17 
GeneralMy vote of 4 Pin
markfilan8-Jan-11 6:38
membermarkfilan8-Jan-11 6:38 
GeneralMy vote of 2 Pin
KarstenK26-Aug-10 23:29
memberKarstenK26-Aug-10 23:29 
GeneralSplitting a video file Pin
Vedavyasaachar19-Aug-09 1:19
memberVedavyasaachar19-Aug-09 1:19 
Generaldownloading code Pin
mohammadarshad279-Apr-08 20:11
membermohammadarshad279-Apr-08 20:11 
GeneralPlaying the file through buffer Pin
nitin_pro31-Oct-07 0:21
membernitin_pro31-Oct-07 0:21 
QuestionPlaying the MP3 file through buffer Pin
nitin_pro22-Oct-07 2:39
membernitin_pro22-Oct-07 2:39 
I had downloaded your source code of MP3 Player it helps it but i have some problem actually i want to give the buffer as input instead of file.
I want to pass the buffer of a playing file.
kindly look into the matter
Generalit is just cool [modified] Pin
jacej27-Jul-07 6:40
memberjacej27-Jul-07 6:40 
GeneralThis cool! Pin
earth_cg8-Mar-07 7:54
memberearth_cg8-Mar-07 7:54 
QuestionCan not play AVI Pin
psamir9-Oct-06 21:59
memberpsamir9-Oct-06 21:59 
GeneralMCI Error Pin
naraimha4-Oct-06 3:58
membernaraimha4-Oct-06 3:58 
QuestionCan this program play WAV? Pin
Aki Wang3-Aug-06 0:55
memberAki Wang3-Aug-06 0:55 
AnswerRe: Can this program play WAV? Pin
Aki Wang3-Aug-06 1:29
memberAki Wang3-Aug-06 1:29 
GeneralAL Pin
vnsr8-Jun-06 5:00
membervnsr8-Jun-06 5:00 
QuestionProblems Pin
nepobunceno18-Apr-06 14:42
membernepobunceno18-Apr-06 14:42 
Questionhow to play the mp3 song in the required output device, is there any function to specify the output device id for mp3 Pin
Farooq kotwal22-Jun-05 2:05
memberFarooq kotwal22-Jun-05 2:05 
GeneralResolving Building Errors Pin
RobertOls19746-May-05 7:15
memberRobertOls19746-May-05 7:15 
GeneralRe: Resolving Building Errors Pin
Anonymous30-Jun-05 5:36
sussAnonymous30-Jun-05 5:36 
GeneralImplementing the progressbar Pin
retgrr34t15-Apr-05 3:57
memberretgrr34t15-Apr-05 3:57 
GeneralAdding a volume button Pin
SaraMalkaW9-Jan-05 16:05
memberSaraMalkaW9-Jan-05 16:05 
GeneralRe: Adding a volume button Pin
Anonymous30-Jun-05 5:19
sussAnonymous30-Jun-05 5:19 
GeneralHide Slider Control Pin
jun___2-Dec-04 21:56
memberjun___2-Dec-04 21:56 
GeneralRe: Hide Slider Control Pin
silufear15-Jun-07 16:51
membersilufear15-Jun-07 16:51 
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
santra28-May-03 22:54
susssantra28-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
sussoqnet19-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
sussAnonymous31-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
sussAnonymous20-Oct-02 18:20 
GeneralRe: How to loop continously?? Pin
oqnet19-Apr-05 16:01
sussoqnet19-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
sussoqnet19-Apr-05 15:29 
GeneralCodecs required Pin
Armen Hakobyan22-Jul-02 17:40
memberArmen Hakobyan22-Jul-02 17:40 
Generalplay avi files in .net environment Pin
linus lee20-May-02 23:16
memberlinus lee20-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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171207.1 | Last Updated 14 Jun 2001
Article Copyright 2001 by BLaZe
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid