Reuse MMControl to Play Music File in New Framework 4

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.
 
image1.gif
 
A box will open chose COM Components & browse MCI32.ocx from C:\Windows\system32
 
image2.gif
 
& after loading it looks like,
 
image3.gif
 
Then the tool box get the control,
 
image4.gif
 
Now add the Control in your from, it looks like previous one (VS 6),
 
image5.gif
 
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,
  1. private void button1_Click(object sender, EventArgs e)  
  2. {  
  3.             axMMControl1.Command = "close";  
  4.             axMMControl1.FileName = textBox1.Text;  
  5.             axMMControl1.Command = "open";  
  6.             axMMControl1.Command = "play";  

And now in can play not only wav sound but also, mp3, mpeg, wav, wma.
 
Finally it looks like
 
image6.gif
 
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.