我机器上有两光驱,下面这段代码只能弹出第一个光驱,无法指定弹出第二个光驱。
应该怎么写才可能呢?
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 );
}
}