C#控制光驱开关
调用Windows API函数mciSendString();
url:http://greatverve.cnblogs.com/archive/2011/07/25/api-mciSendString.html
光驱弹出与关闭
//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);
}
//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);
}
我这个博客废弃不用了,今天想寻找外链的时候,突然想到这个博客权重很高。
有需要免费外链的,留言即可,我准备把这个博客变成免费的友情链接站点。