Click here to Skip to main content
11,804,574 members (91,197 online)
Click here to Skip to main content

A very simple MP3 Player

, 13 Jun 2001 516.4K 9K 126
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

GeneralMCI Error Pin
naraimha4-Oct-06 2:58
membernaraimha4-Oct-06 2:58 
QuestionCan this program play WAV? Pin
Aki Wang2-Aug-06 23:55
memberAki Wang2-Aug-06 23:55 
AnswerRe: Can this program play WAV? Pin
Aki Wang3-Aug-06 0:29
memberAki Wang3-Aug-06 0:29 
GeneralAL Pin
vnsr8-Jun-06 4:00
membervnsr8-Jun-06 4:00 
Dear Blaze
I 've used your code. It 's simple but greate enough to run properly. But there 's still one problem I cannot overcome. I'm writting a "Multi AVI Player" Application using MultiThreading technique. When I tried to run many AVI files on many dialogs at the same time, the problem appears. ONLY THE PLAYER ON THE FIRST THREAD SOUNDS AND THE OTHER ARE SILENT. I did try to fix it, but nothing changed. Please give me some advices for this. Thank you very much (^__^)
From HoChiMinh City, VietNam

QuestionProblems Pin
nepobunceno18-Apr-06 13:42
membernepobunceno18-Apr-06 13: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 1:05
memberFarooq kotwal22-Jun-05 1:05 
GeneralResolving Building Errors Pin
RobertOls19746-May-05 6:15
memberRobertOls19746-May-05 6:15 
GeneralRe: Resolving Building Errors Pin
Anonymous30-Jun-05 4:36
sussAnonymous30-Jun-05 4:36 
GeneralImplementing the progressbar Pin
retgrr34t15-Apr-05 2:57
memberretgrr34t15-Apr-05 2:57 
GeneralAdding a volume button Pin
SaraMalkaW9-Jan-05 15:05
memberSaraMalkaW9-Jan-05 15:05 

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