473,320 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to open and stop WindowsMediaPlayer using C# Windows App

Hello everyone,

I want to open and stop the Video files in the WindowsMediaPlayer through a C# Windows application. I am using a third party GUI software, so I wont be able to add WMPlayer control on to my application. I just need to control the WMPlayer by the code.
The below mentioned sample code is able to open the player and play the Video file. But the stop and close functionalities are not working in this.
Can U please tell me how to control the mediaplayer through code. I want to implement functionalities like 'Pause', 'Fullscreen' etc..


using WMPLib;

namespace Sample_MediaPlayer
{

public partial class Form1 : Form
{
private WindowsMediaPlayerClass wmPlayer = new WindowsMediaPlayerClass();
//private WindowsMediaPlayer wmPlayer = new WindowsMediaPlayer();

public Form1()
{
InitializeComponent();
}

private void Play_Click(object sender, EventArgs e)
{
wmPlayer.openPlayer(@"C:\SampleVideo.wmv");

}

private void Stop_Click(object sender, EventArgs e)
{
wmPlayer.close();
//wmPlayer.controls.stop();
}
}
}



- Thanks
Apr 26 '07 #1
0 4766

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: midnighthell | last post by:
I'm looking for one sample (code) , how to make that doors of cdrom (recorder, never mind) to be open on button press. thanks...
2
by: Shorty | last post by:
Hi, I'm trying to incorporate the windowsmediaplayer.ocx in my program to play some music. I can add it, but I can't figure out how to control the bloody thing. I've searched the net for the...
1
by: Rooly | last post by:
where is WindowsMediaPlayer component in VS 2005?? in win 2003 I see it in Toolbox.. but in 2005 I can not see it!
2
by: Rinaldo | last post by:
Can you record from WindowsMediaPlayer anyway? Yes! how? Rinaldo
1
by: gopalkrishna | last post by:
Hi, How to get bitrate for windows media player using javascript for IE ?. for example i am trying like this var bitRate = document.MediaPlayer.network.bitRate; it is fine working in...
1
by: santel | last post by:
Hi, I have used WindowsMediaPlayer control in C# forms. I need to paint some rectangle on top of the WMP control. But the rectangle displays on back of the WMP control. Is there any way to bring...
1
by: thomasc | last post by:
Hello, This question is about VB.NET2003. I have a WindowsMediaPlayer Control on a windows form. Now I want to create a playlist for the control so it plays all the media files specified in...
2
by: thomasc | last post by:
Hi, I am a newbie VB.NET2003 user. I'd like to find out the property setting or the 'settings' interface of WindowsMediaPlayer(WMP.dll) control to make the player repeat its multimedia file...
0
by: =?Utf-8?B?amJkYXZpcw==?= | last post by:
I am trying to figure out how to set plugins on/off within the WindowsMediaPlayer control. If you have the contextmenu set on you can right click on the player and get a menu with a Plugins option...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.