老式的光驱,因为其保存时间持久,在一些特殊项目中,还在使用.
.net 程序如果想控制光驱的打开和关闭,非常简单.
[DllImport("winmm.dll", EntryPoint = "mciSendString")]
public static extern int mciSendString(string lpstrCommand, string lpstrReturnString, System.UInt16 uReturnLength, System.IntPtr HwndCallback);
然后控制打开和关闭:
int i = mciSendString("Set cdaudio door open wait", "", 0, this.Handle);
int i = mciSendString("Set cdaudio door Closed wait", "", 0, this.Handle);