We can Play Mp3, Mpeg, Wav, and Wma Music File with MMControl [Microsoft Multimedia Control]
It's come with Visual Studio 6. Now in this article we see how we reuse this file with Visual studio 2010 in C# 4.0
The original file is placed in C:\Windows\system32\MCI 32.OCX , First we browse it for our project.
First we create a tab in toolbox in this example I create "Import VS6" tab, then Right Click on it & select chose Item.
A box will open chose COM Components & browse MCI32.ocx from
C:\Windows\system32
& after loading it looks like,
Then the tool box get the control,
Now add the Control in your from, it looks like previous one (VS 6),
Set the properties of control, visible =false (if you write your own command button) like almost VB add the command to play music file as,
- private void button1_Click(object sender, EventArgs e)
- {
- axMMControl1.Command = "close";
- axMMControl1.FileName = textBox1.Text;
- axMMControl1.Command = "open";
- axMMControl1.Command = "play";
- }
And now in can play not only wav sound but also, mp3, mpeg, wav, wma.
Finally it looks like
Few notes: If you have no MCI32.OCX, don't worry I upload here the entire essential file. You can play music also using other older windows dll file & new code which come from direct .net , that's it.
Thank you.