我机器上有两光驱,下面这段代码只能弹出第一个光驱,无法指定弹出第二个光驱。应该怎么写才可能呢?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条经验 获得超6个赞
我也很好奇,google一下,答案如下: //M:是光驱所在的盘符 mciSendString('open M: type CDAudio alias finch wait', nil, 0, Self.Handle); //打开光驱 mciSendString('set finch door open wait', nil, 0, Self.Handle); //关闭光驱 // mciSendString('set finch door closed wait', nil, 0, Self.Handle); mciSendString('Close finch', nil, 0, Self.Handle);
- 2 回答
- 0 关注
- 614 浏览
添加回答
举报
0/150
提交
取消