Click here to Skip to main content
Click here to Skip to main content

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

Comments and Discussions

Questionhow can i modify this to play in linux Pinmembermaheshkk6-Apr-04 20:54 
GeneralMMSYSTEM 296 ERROR while play mp3 file Pinmemberchuit5-Jan-04 11:28 
QuestionCan this Mp3player run on a DSP chipset ? PinmemberJiangcr8117-Nov-03 16:49 
GeneralGood but want more ;-) PinmemberBoscoW14-Jun-03 6:48 
Hi I'm making an Mp3 Player witch this code is also simple but it can a bit more you can download it at (german website but you should find the download link Wink | ;-) )
but now i want to make it better and i look into the msdn so now i know that i can make it more better with this method of playing mp3 So if someone can give me some links for other methods ...

GeneralRe: Good but want more ;-) Pinmemberelectriac17-Nov-06 6:22 
Generalurgent help!!!!!!!! Pinsusssantra28-May-03 22:54 
Questionhow to detect end of song ? Pinmemberrmajda23-Apr-03 23:31 
AnswerRe: how to detect end of song ? Pinsussoqnet19-Apr-05 15:41 
QuestionCan this mp3 player do real time decoding? Pinmemberfcfc13-Apr-03 23:56 
AnswerRe: Can this mp3 player do real time decoding? PinmemberDJWALSH14-Apr-03 3:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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.150414.1 | Last Updated 14 Jun 2001
Article Copyright 2001 by BLaZe
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid