编程地弹出和收回在vb.net或C#CD驱动器 [英] Programatically ejecting and retracting the CD drive in vb.net or c#
问题描述
有没有办法这样做呢?我知道它可以以编程方式退出/缩回莫名其妙的CD驱动器,导致Roxio的做,当它提示我插入磁盘。
C#或vb.net为preferable,但C和C ++都还好过作为最后的手段。
我几乎可以肯定的是有一些方法来做到这一点,我只是不知道这个方法调用。
我明白这是一个有点不寻常的要求,如谷歌,当我搜索的方法,取得了绝对没有...
使用System.Runtime.InteropServices;函数[DllImport(WINMM.DLL)]
静态外部的Int32 mciSendString(字符串命令,StringBuilder的缓冲区,缓冲区大小的Int32,IntPtr的hwndCallback);//要开门
mciSendString(设置CDAudio开门,NULL,0,IntPtr.Zero);//关门
mciSendString(设置CDAudio大门紧闭,NULL,0,IntPtr.Zero);
的http://www.geekpedia.com/tutorial174_Opening-and-closing-the-CD-tray-in-.NET.html
Is there any way to do so? I know its possible to programmatically eject/retract the cd drive SOMEHOW, cause Roxio does that when it prompts me to insert a disk.
Either c# or vb.net is preferable, but c and c++ are okay too as a last resort.
I am nearly positive there is some way to do this, I just don't know the methods to call.
I do understand this is a somewhat unusual request, as Google yielded absolutely nothing when I searched for the methods...
using System.Runtime.InteropServices;
[DllImport("winmm.dll")]
static extern Int32 mciSendString(String command, StringBuilder buffer, Int32 bufferSize, IntPtr hwndCallback);
// To open the door
mciSendString("set CDAudio door open", null, 0, IntPtr.Zero);
// To close the door
mciSendString("set CDAudio door closed", null, 0, IntPtr.Zero);
http://www.geekpedia.com/tutorial174_Opening-and-closing-the-CD-tray-in-.NET.html
这篇关于编程地弹出和收回在vb.net或C#CD驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!