File->New->Project
Then you have to select c# windows form application and give the name and location for your project. After that press ok.
Then Right-click on the toolbox and press "choose Items". Then the following window will appear.
Press "COM component" tab.
Then put a tick on windows media player according to the following picture and press OK.
Now you can see there is tool "Windows media player" on the bottom of the toolbox.
Then drag and drop and change the size as you wish.
After that drag and drop a Menu Strip from the toolbox and give the first one as "Open".
Then Double-click on "Open".
OpenFileDialog open = new OpenFileDialog();
open.Title = "Open";
open.Filter = "All Files|*.*";
try
{
if(open.ShowDialog()==System.Windows.Forms.DialogResult.OK)
axWindowsMediaPlayer1.URL=(open.FileName);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString(),"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
I tried it and it worked macho. Can we use the player by taking only the generated exe file ? I tried it but it didn't work.
ReplyDelete