C#怎样打开关闭CDROM?
try
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 );
}
}
IOCTL好像也可以,不过,没试过,用saucer老大的方法吧!
在linux下运行的c#的话,用shell命令eject可以弹出……
嘿嘿
学习
up!
学习
支持: saucer(思归, MS .NET MVP)