来自:http://outofmemory.cn/code-snippet/470/c-open-close-CD-DVD-guangqu-code
using System.Runtime.InteropServices;
using System.Text;
...
public static void Main( )
{
int result = mciSendString
("set cdaudio door open", null, 0, IntPtr.Zero);
result =
mciSendString ("set cdaudio door closed",
null, 0, IntPtr.Zero);
}
[DllImport("winmm.dll", EntryPoint="mciSendStringA", CharSet=CharSet.Ansi)]
protected static extern int mciSendString
(string mciCommand,
StringBuilder returnValue,
int returnLength,
IntPtr callback);

本文提供了一段使用 C# 实现控制 CD/DVD 光驱开合的代码示例。通过调用 WinMM DLL 中的 mciSendString 函数,可以实现光驱门的打开和关闭。
207

被折叠的 条评论
为什么被折叠?



