ویژوال 30 شارپ

سورس کدهای جالب سی شارپ فقط با یک نگاه

ویژوال 30 شارپ

سورس کدهای جالب سی شارپ فقط با یک نگاه

Play Sound And Video

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);
    }
}

نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد