我機器上有兩光驅(qū),下面這段代碼只能彈出第一個光驅(qū),無法指定彈出第二個光驅(qū)。應該怎么寫才可能呢?using System;using System.Text;using System.Runtime.InteropServices;class CloseCD{ [DllImport( "winmm.dll", EntryPoint="mciSendStringA", CharSet=CharSet.Ansi )] protected static extern int mciSendString( string lpstrCommand, StringBuilder lpstrReturnString, int uReturnLength, IntPtr hwndCallback ); public static void Main() { int ret = mciSendString( "set cdaudio door open", null, 0, IntPtr.Zero ); Console.ReadLine(); ret = mciSendString( "set cdaudio door closed", null, 0, IntPtr.Zero ); }}
2 回答

夢里花落0921
TA貢獻1772條經(jīng)驗 獲得超6個贊
我也很好奇,google一下,答案如下: //M:是光驅(qū)所在的盤符 mciSendString('open M: type CDAudio alias finch wait', nil, 0, Self.Handle); //打開光驅(qū) mciSendString('set finch door open wait', nil, 0, Self.Handle); //關閉光驅(qū) // mciSendString('set finch door closed wait', nil, 0, Self.Handle); mciSendString('Close finch', nil, 0, Self.Handle);
- 2 回答
- 0 關注
- 642 瀏覽
添加回答
舉報
0/150
提交
取消