Click here to Skip to main content
13,042,630 members (78,580 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

GeneralGreat Program Pin
sk-i-za7-Aug-02 7:38
susssk-i-za7-Aug-02 7:38 
GeneralHolds on to previous file Pin
codermallu1-Aug-02 3:58
membercodermallu1-Aug-02 3:58 
GeneralRe: Holds on to previous file Pin
oqnet19-Apr-05 14:29
sussoqnet19-Apr-05 14:29 
GeneralCodecs required Pin
Armen Hakobyan22-Jul-02 16:40
memberArmen Hakobyan22-Jul-02 16:40 
Generalplay avi files in .net environment Pin
linus lee20-May-02 22:16
memberlinus lee20-May-02 22:16 
GeneralChanging soundcards. Pin
Largie2-Mar-02 0:51
memberLargie2-Mar-02 0:51 
GeneralRe: Changing soundcards. Pin
BLaZiNiX2-Mar-02 6:04
memberBLaZiNiX2-Mar-02 6:04 
GeneralRe: Changing soundcards. Pin
Largie3-Mar-02 21:04
memberLargie3-Mar-02 21: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 0:22
memberGuitool30-Jul-02 0:22 
GeneralGood for beginner Pin
LIK27-Feb-02 6:17
memberLIK27-Feb-02 6:17 
GeneralCant compile it :( Pin
antivoid4-Jan-03 23:37
memberantivoid4-Jan-03 23:37 
GeneralI like it:) Pin
Mazdak20-Feb-02 3:52
memberMazdak20-Feb-02 3:52 
Generalto handle mci_stop message Pin
Jaggu13-Dec-01 11:11
memberJaggu13-Dec-01 11:11 
GeneralMp3 player Pin
Jarek Gibek7-Sep-01 2:18
memberJarek Gibek7-Sep-01 2:18 
GeneralRe: Mp3 player Pin
Anonymous10-Mar-02 14:38
memberAnonymous10-Mar-02 14:38 
GeneralBook Pin
Brian Hart15-Jun-01 5:07
memberBrian Hart15-Jun-01 5:07 
GeneralRe: Book Pin
Anonymous19-Jun-01 6:04
memberAnonymous19-Jun-01 6:04 
GeneralNot an MP3 player Pin
Anonymous14-Jun-01 6:20
memberAnonymous14-Jun-01 6:20 
GeneralRe: Not an MP3 player Pin
LOXmith21-Jun-01 21:25
memberLOXmith21-Jun-01 21:25 
GeneralRe: Not an MP3 player Pin
zrsoft16-Dec-01 4:36
memberzrsoft16-Dec-01 4:36 
GeneralRe: Not an MP3 player Pin
Anonymous21-Jul-02 15:03
sussAnonymous21-Jul-02 15:03 
GeneralRe: Not an MP3 player Pin
Christian Graus21-Jul-02 15:30
memberChristian Graus21-Jul-02 15:30 
Generalagree. It is not the code that i expect. Pin
sodic29-Jun-02 10:36
membersodic29-Jun-02 10:36 
GeneralGood job for 15 years old Pin
Brian V Shifrin14-Jun-01 5:30
memberBrian V Shifrin14-Jun-01 5:30 
GeneralRe: Good job for 15 years old Pin
BLaZe14-Jun-01 5:44
memberBLaZe14-Jun-01 5:44 

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