C#控制光驱开关

using System.Runtime.InteropServices ;
[DllImport("winmm.dll")]
public static extern int mciSendString(string s1, string s2, int i1, int i2);
private void button1_Click(object sender, System.EventArgs e)
{
//打开光驱
    mciSendString("set cdaudio door open", "", 0, 0);
}
private void button2_Click(object sender, System.EventArgs e)
{
//关闭光驱
    mciSendString("set cdaudio door closed", "", 0, 0);
}
posted @ 2008-10-23 11:14  Landy_di  阅读(126)  评论(0编辑  收藏  举报