谁能告诉我开关光驱的API函数?(50分)

  • 主题发起人 主题发起人 guangmin
  • 开始时间 开始时间
It seems something in DirectX.
 
首先
uses mmsystem;
然后,定义一个cdaudio设备的别名,以后通过该别名操纵光驱
在这里,定义的别名是cd
mciSendString('open cdaudio alias cd wait shareable', nil, 0, 0);
这个函数打开cddo
or
mciSendString('set cddo
or open',nil, 0, 0);
这个函数关闭cddo
or
mciSendString('set cddo
or closed',nil, 0, 0);
 
不用别名直接用cdaudio就行。
mciSendString('set cdaudiodo
or open',nil, 0, 0);
mciSendString('set cdaudiodo
or closed',nil, 0, 0);
 
其实用不用别名都无所谓,
函数用对了就行
 
http://vcl.vclxx.com/DELPHI/D32FREE/DRVTOOLS.ZIP
 
有没有更简单的办法?还要加入一个控件???
我faint!
 
我靠! mmsystem单元是delphi自己带的,哪用什么控件???!!!!
再简单的例子不可能了!
 
>>再简单的例子不可能了
Win32 API:
BOOL <font color=red>DeviceIoControl</font>(
HANDLE hDevice, // handle to device of interest
DWORD dwIoControlCode, // control code of operation to perform
LPVOID lpInBuffer, // pointer to buffer to supply input data
DWORD nInBufferSize, // size of input buffer
LPVOID lpOutBuffer, // pointer to buffer to receive output data
DWORD nOutBufferSize, // size of output buffer
LPDWORD lpBytesReturned, // pointer to variable to receive output byte count
LPOVERLAPPED lpOverlapped // pointer to overlapped structure for asynchronous operation
);
....
dwIoControlCode:
Specifies the control code for the operation.
...
Value Meaning
... ...
<font color=red>IOCTL_STORAGE_EJECT_MEDIA</font> Ejects media from a SCSI device.

可我不知道怎么得到光驱的Handle,想用CreateFile,但Help中说
NT下可以用CreateFile取目录的Handle,95下不行,
而且我也没实验成功
所以DeviceIOControl我也没办法实验,行不行<B>我不知道</B>
 
还不如mciSendString简单呢!
 
????????????????
 
后退
顶部