basic wmp
I am working on a basic wmp application for an assignment but have dont have much c# knowledge. The basic outline of the project is 2 combo boxes one for entering a path or url which will be played by pressing the go button and the other to enter keywords which when we press search will search the location combobox for that keyword. Their are also a few buttons just the usual stop play pause they are all done. And finally they wmp box at the bottom. I am having trouble getting the path i have typed into the location text box to play in the programs wmp box when i click the go button, i have only managed to have it open up wmp externally and play it. So thats about all im stuck with for now im sure i will have other problems further down the track but taking it one thing at a time. All help is greatly appreciated thanks.
Scott LyslePosted May 6, 2007, 4:55 AM
Ok, to demonstrate I dropped a media player control onto a form, set it dock full, and dropped a menu control onto the form; the menu control had five options: Load Audio File, Load Video File, Start, Stop, and Pause. This is the code that is necessary to implement each:
private
void audioToolStripMenuItem_Click(object sender, EventArgs e){
this.axWindowsMediaPlayer1.URL = "C:\\Scott\\Audio\\ans_Arnold.wav";
} private void loadVideoToolStripMenuItem_Click(object sender, EventArgs e)
{
this.axWindowsMediaPlayer1.URL = "C:\\Scott\\Video\\Beatles - Hey Bulldog.mpg";
} private void startToolStripMenuItem_Click(object sender, EventArgs e)
{
this.axWindowsMediaPlayer1.Ctlcontrols.play();
} private void stopToolStripMenuItem_Click(object sender, EventArgs e)
{
this.axWindowsMediaPlayer1.Ctlcontrols.stop();
} private void pauseToolStripMenuItem_Click(object sender, EventArgs e)
{
this.axWindowsMediaPlayer1.Ctlcontrols.pause();
}
Bob rogenPosted May 5, 2007, 4:12 AM
Scott LyslePosted May 5, 2007, 3:56 AM
Are you trying to control the media player from an external application (i.e., are you opening up the Windows Media Player and sending commands to it through WM_COMMAND) or are you just trying to use the activeX control. Neither is difficult but I don't know which way you going with your project.