Can any one please tell me which API can i use to Eject or Insert a CD in the CD-Rom Drive???
Posted on 2003-04-28 08:51:10 by telophase
I asked the exact same question here a while back :)
Posted on 2003-04-28 08:55:14 by donkey




include \masm32\include\winmm.inc
includelib \masm32\lib\winmm.lib

.data
szOpen db 'set cdaudio door open',0
szClose db 'set cdaudio door closed',0

.code


invoke mciSendStringA, addr szOpen, 0, 0, 0 ; open the door
invoke mciSendStringA, addr szClose, 0, 0, 0 ; close the door

Posted on 2003-04-28 10:49:07 by Axial
These two functions eject only main cd-rom (which is set as a cd audio device). I have two cd-roms (drive letters E: and F:). How can I eject the one chosen by me (using api functions, not interrupts)?
Posted on 2003-04-29 10:34:27 by Czajnick
include \dev\include\masm\winmm.inc

includelib \dev\lib\masm\winmm.lib

.CODE

ejectd DB "open d: type cdaudio alias cd", 0
ejectf DB "open f: type cdaudio alias cd", 0
drvopen DB "set cd door open", 0
drvclosed DB "set cd door closed", 0

start:

invoke mciSendString, OFFSET ejectd, 0, 0, 0
invoke mciSendString, OFFSET drvopen, 0, 0, 0

invoke MessageBox, 0, 0, 0, 0

invoke mciSendString, OFFSET drvclosed, 0, 0, 0

invoke Sleep, 2000

invoke mciSendString, OFFSET ejectf, 0, 0, 0
invoke mciSendString, OFFSET drvopen, 0, 0, 0

invoke MessageBox, 0, 0, 0, 0

invoke mciSendString, OFFSET drvclosed, 0, 0, 0
the second drive will open after a few seconds after the first drive is closed. You can replace the sleep function with a window saying "opening F: drive... please wait.." or something like that. :grin:
Posted on 2003-04-29 10:57:54 by arkane