I am trying to create a Windows Form application to play .WMV files.
I have 5 videos that i have added to my project, within a Videos folder.
I have created a button for each video, 5.
When a button is clicked, Button1, i want to be able to open Video1.. Using Windows Media Player for example.
Code so far::
private void PlayVideo1_Click(object sender, EventArgs e)
{
// Open Windows Media Player
System.Diagnostics.Process.Start("wmplayer.exe");
// Play Video1.
Process.Start("Video1.wmv");
}
Please can you advise what i am doing wrong?
========================
Update:
Can a similar code be used for WPF?
Is the WMV files set to “Copy always” in the “Copy to output Directory” property? Like in the picture below:
If it is, then the files are going to the same directory as the application, the next step is to run the WMV from the propert path,
Your code:
Is not wrong to want to start the WMV directly (that way, the default player in the target machine will run), but you need to send the full path (C:\Video.WMV for eg)
If the WMV files are inside a VIDEOS folder within your application, you could change to do like this for eg: