I would like get the same functionality in my (Borland C++ builder) code as what happens when you right click on a CD-ROM drive in My Computer and choose "Eject".
I'm perfectly able of opening the tray of whatever drive I'd like through the ASPI layer (sending a Start/Stop Unit command) or through the use of DeviceIOControl (only NT).
Unfortunately this is too low-level to be useable for me since it bypasses any application which could have control over the disc in the drive.
For example, Adaptec's Direct CD (UDF writer) keeps some data cached, you can send commands directly to the drive through the ASPI layer and you will be able to open the tray (Allow medium removal + Start/Stop Unit), but this will cause DirectCD to be unaware of any medium removal request and it will fail to complete all necessary actions (such as flushing buffers) prior to removal (with dramatic consequences, such as data loss on the CD-R/RW).
I've found a partial solution :
mciSendSTring("set cdaudio door open",NULL,0,NULL);
and this works great ! Any application such as DirectCD will be informed of this eject request and will take care of business before ejecting.
UNFORTUNATELY I am unable to select which drive will be opened (it seems as if it always picks the first drive).
So, isn't this possible with MCI ? (which would suprise me)
If not, can you suggest something that works on the same level as MCI and also offers the ability to select which drive you want to control.
So, in short :
I'll need some way of opening the tray that :
- Isn't too low level for other applications too miss (such as MCI).
- That works both in Win98, WinNT and Win2K.
- And I should be able to select the drive which I want to control.
Or if somebody just could tell me how to select a drive with MCI...