using System.Runtime.InteropServices;
string CommandString;
OpenFileDialog file = new OpenFileDialog();
[DllImport("winmm.dll")]
private static extern long mciSendString(string lpstrCommand, StringBuilder lpstrReturnString, int uReturnLength, int hwndCallback);
private void button1_Click(object sender, System.EventArgs e)
{
if (file.ShowDialog() == DialogResult.OK)
{
CommandString = "open " + "\"" + file.FileName + "\"" + " type MPEGVideo alias MediaFile";
mciSendString(CommandString, null, 0, 0);
CommandString = "play MediaFile";
mciSendString(CommandString, null, 0, 0);
}
}