Spielt MP3, WMA und so weiter ab.
using System.Diagnostics;
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);
public string befehl;
private void btn_laden_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
label1.Text = openFileDialog1.FileName;
befehl = "open \"" + label1.Text +"\" type MPEGVideo alias MediaFile";
mciSendString(befehl, null, 0, IntPtr.Zero);
}
}
private void txt_Abspielen_Click(object sender, EventArgs e)
{
befehl = "play MediaFile from 0";
mciSendString(befehl , null, 0, IntPtr.Zero);
}
1 Kommentare zum Snippet