I have tried this code:
uses MMSystem;
mciSendString('Set cdaudio door open wait', nil, 0, handle);
mciSendString('Set cdaudio door closed wait', nil, 0, handle);
but there was no effect. I have heard that this does not work on all systems.
I’m trying to get a drive to eject on Windows XP, and would like to specify the drive via the drive letter (necessary for systems with multiple drives).
This is code using the DeviceIOControl() API function, works for me on Windows XP (compiled and tested using Delphi 5):
Error handling omitted.