AlabamaHit
AlabamaHit

Reputation: 31

c# playing movie in windows media player "Not" embedded

I have looked around, everything I find is talking about embedding it.

I do not want to embed it. I want to click a button and launch windows media player seperatly.

For example, I have a location saved in XML file. I have a right click to click Play. It pulls the location. like so.

    int dd = dataGridView1.CurrentRow.Index;
    string eLoc = dataGridView1.Rows[dd].Cells[4].Value.ToString();
    if (eLoc == "")
    {
        MessageBox.Show("You have not saved a location for this movie","Movie Play",MessageBoxButtons.OK,MessageBoxIcon.Information);
    }
    else
    {
        MessageBox.Show(eLoc);
        ProcessStartInfo ps = new ProcessStartInfo("wmplayer.exe", eLoc.ToString());
        Process.Start(ps);
    }

As you can see, I have a pop up to view, what the string is.

It is this. I added %20 to replace spaces, thinking that was the problem but it isn't. Movie Locaiton

As you can see it pulls the full location. All I get back from windows media player is this.

WMP Error

Any ideas? To me it seems like this should be working..

Upvotes: 0

Views: 1723

Answers (2)

AlabamaHit
AlabamaHit

Reputation: 31

I got it working now. It was the spaces causing the errors, I changed to this, and works perfect now.

ProcessStartInfo ps = new ProcessStartInfo("wmplayer.exe", "\""+eLoc+"\"");

Upvotes: 2

kieranjl
kieranjl

Reputation: 23

It should be working, in fact on my computer and with a different path it does work, I suspect the file is damaged like jfs suggested.

Upvotes: 0

Related Questions