Click here to Skip to main content
11,934,214 members (38,618 online)
Click here to Skip to main content
Add your own
alternative version


126 bookmarked

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. Smile | :)

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

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 
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 
I have found a Windows Mediaplayer EULA SDK, but it did not make me any wizer! Wink | ;)

The SDK is pretty straight forward, but it uses only the primary directsound object (COM) and sends the "sound" to it.

I have not found any option in the media player (normal use) to change the output card, either than using the "Multimedia" option in the "Control Panel". But it changes the soundcard for every playback.

Dead | X|

Lars Werner , aka Largie

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 
GeneralRe: Not an MP3 player Pin
LOXmith21-Jun-01 22:25
memberLOXmith21-Jun-01 22:25 
GeneralRe: Not an MP3 player Pin
zrsoft16-Dec-01 5:36
memberzrsoft16-Dec-01 5:36 
GeneralRe: Not an MP3 player Pin
Anonymous21-Jul-02 16:03
sussAnonymous21-Jul-02 16:03 
GeneralRe: Not an MP3 player Pin
Christian Graus21-Jul-02 16:30
memberChristian Graus21-Jul-02 16:30 
Generalagree. It is not the code that i expect. Pin
sodic29-Jun-02 11:36
membersodic29-Jun-02 11:36 
GeneralGood job for 15 years old Pin
Brian V Shifrin14-Jun-01 6:30
memberBrian V Shifrin14-Jun-01 6:30 
GeneralRe: Good job for 15 years old Pin
BLaZe14-Jun-01 6:44
memberBLaZe14-Jun-01 6:44 
GeneralRe: Good job for 15 years old Pin
Carlos Antollini14-Jun-01 6:47
memberCarlos Antollini14-Jun-01 6:47 
GeneralRe: Good job for 15 years old Pin
Giles Forster14-Jun-01 12:51
memberGiles Forster14-Jun-01 12:51 
GeneralRe: Good job for 15 years old Pin
Carlos Antollini14-Jun-01 13:05
memberCarlos Antollini14-Jun-01 13:05 
GeneralRe: Good job for 15 years old Pin
Mike Stevenson18-Jun-01 11:32
memberMike Stevenson18-Jun-01 11:32 
GeneralRe: Good job for 15 years old Pin
Anonymous19-Jun-01 10:29
memberAnonymous19-Jun-01 10:29 
GeneralRe: What's Logo Pin
William E. Kempf21-Jun-01 10:10
memberWilliam E. Kempf21-Jun-01 10:10 
GeneralRe: What's Logo Pin
Atlantys8-Feb-02 9:15
memberAtlantys8-Feb-02 9:15 
GeneralRe: Good job for 15 years old Pin
swinefeaster11-Aug-01 21:00
memberswinefeaster11-Aug-01 21:00 
GeneralRe: Good job for 15 years old Pin
Giles Forster12-Aug-01 1:56
memberGiles Forster12-Aug-01 1:56 
GeneralRe: Good job for 15 years old Pin
loyal ginger30-Aug-10 4:10
memberloyal ginger30-Aug-10 4:10 
GeneralRe: Good job for 15 years old Pin
loyal ginger30-Aug-10 8:58
memberloyal ginger30-Aug-10 8:58 
GeneralRe: Good job for 15 years old Pin
loyal ginger30-Aug-10 4:12
memberloyal ginger30-Aug-10 4:12 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.151126.1 | Last Updated 14 Jun 2001
Article Copyright 2001 by BLaZe
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid