Click here to Skip to main content
13,398,051 members (43,678 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

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 
This is a great learning aid, easy to follow code ('bit more commenting maybe Wink | ;-) but i'm very impressed nice work
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 
GeneralRe: Changing soundcards. Pin
BLaZiNiX2-Mar-02 7:04
memberBLaZiNiX2-Mar-02 7:04 
GeneralRe: Changing soundcards. Pin
Largie3-Mar-02 22:04
memberLargie3-Mar-02 22:04 
GeneralRe: Changing soundcards. Pin
Guitool30-Jul-02 1:22
memberGuitool30-Jul-02 1:22 
GeneralGood for beginner Pin
LIK27-Feb-02 7:17
memberLIK27-Feb-02 7:17 
GeneralCant compile it :( Pin
antivoid5-Jan-03 0:37
memberantivoid5-Jan-03 0:37 
GeneralI like it:) Pin
Mazdak20-Feb-02 4:52
memberMazdak20-Feb-02 4:52 
Generalto handle mci_stop message Pin
Jaggu13-Dec-01 12:11
memberJaggu13-Dec-01 12:11 
GeneralMp3 player Pin
Jarek Gibek7-Sep-01 3:18
memberJarek Gibek7-Sep-01 3:18 
GeneralRe: Mp3 player Pin
Anonymous10-Mar-02 15:38
memberAnonymous10-Mar-02 15:38 
GeneralBook Pin
Brian Hart15-Jun-01 6:07
memberBrian Hart15-Jun-01 6:07 
GeneralRe: Book Pin
Anonymous19-Jun-01 7:04
memberAnonymous19-Jun-01 7:04 
GeneralNot an MP3 player Pin
Anonymous14-Jun-01 7:20
memberAnonymous14-Jun-01 7:20 

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
Web04 | 2.8.180216.1 | Last Updated 14 Jun 2001
Article Copyright 2001 by BLaZe
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid