1. CD eject
- Posted by weddle at psknet.com Jul 14, 2002
- 495 views
This is a multi-part message in MIME format. ------=_NextPart_000_000B_01C22B36.166D85E0 charset="iso-8859-1" I'm wondering if anyone has a code (windows) that will access a CD-ROM = drive and make it eject.? Thanks! ------=_NextPart_000_000B_01C22B36.166D85E0 charset="iso-8859-1" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2> <DIV><FONT face=3DArial size=3D2>I'm wondering if anyone has a code = (windows) that=20 will access a CD-ROM drive and make it eject.?=20 ------=_NextPart_000_000B_01C22B36.166D85E0--
2. Re: CD eject
- Posted by petelomax at blueyonder.co.uk Jul 15, 2002
- 487 views
{{{ On Sun, 14 Jul 2002 12:58:02 -0400, weddle at psknet.com wrote:
I'm wondering if anyone has a code (windows) that will access a CD-ROM drive
and make it eject.? Thanks!
You could grab this file: http://www.sysinternals.com/files/sync.zip (18K zipped, 44K unzipped). Then a call to system("sync -e F",0)) where F is the correct drive letter will make it eject, but only if there is media in the drive. (Actually, my CD drive is busted but it works for my zip drive). Messy screen flicker, but it works.
Alternatively, install FlexiCD or WinEject or similar & then you'll have an Eject CD menu entry off the taskbar.
Or if you are feeling really brave, and understand what Interrupt 21h Function 440Dh Minor Code 49h is/how to call it (Juergen Luethje might know) I found that at: http://www.allapi.net/apilist/example.php?example=Eject%20CD & it does something different for NT/2000
Pete
3. Re: CD eject
- Posted by Juergen Luethje <jluethje at gmx.de> Jul 15, 2002
- 468 views
Hi Pete, petelomax <petelomax at blueyonder.co.uk> wrote: <snip> >> I'm wondering if anyone has a code (windows) that will access a CD-ROM >> drive and make it eject.? Thanks! <snip> > Or if you are feeling really brave, and understand what Interrupt 21h > Function 440Dh Minor Code 49h is/how to call it (Juergen Luethje might > know) Below there is code to call it on DOS. It works fine for me on DOS 7.1/WIN 98. > -- I found that at: > http://www.allapi.net/apilist/example.php?example=Eject%20CD This is very interesting for me, because it shows how to call this DOS interrupt function on Win9x/Me. I will have a closer look at it, when I've some more time. > & it does something different for NT/2000 > Pete You always know cool interrupt functions! ) Thanks and best regards, Juergen ------------------------------------------------------------------->8--- eject_media.ex ======================================================================== include machine.e constant REG_LIST_SIZE = 10, CF = 1 function eject_media (integer drive) -- successfully tested with my CD drive (see demo code below , -- maybe also works with a zip drive? sequence reg_list reg_list = repeat(0, REG_LIST_SIZE) reg_list[REG_AX] = #440D -- and_bits(.., #DF) is a upper() function for ASCII values, -- works for all ASCII values {A..Z, a..z} reg_list[REG_BX] = and_bits(drive, #DF) - 'A' + 1 reg_list[REG_CX] = #0849 reg_list[REG_FLAGS] = or_bits(reg_list[REG_FLAGS], 1) reg_list = dos_interrupt(#21, reg_list) if and_bits(reg_list[REG_FLAGS], CF) = 1 then return -1 -- error else return 0 end if end function -- Demo integer i puts(1, "As an esteemed customer of our company, we want to\n" & "give you this handy drinks holder as a present.") i = eject_media('e') ------------------------------------------------------------------->8---
4. Re: CD eject
- Posted by munchr at mac.com Jul 15, 2002
- 462 views
At 12:58 PM 14/07/2002 -0400, you wrote: >drive and make it eject.? Thanks! In addition to the links and code posted by Pete Lomax and Juergen Luethje, you might check the following links for information on using MCI commands which will function on all versions of MS Windows. http://pub13.ezboard.com/fvisualbasicexplorerfilesfoldersdirectories.showMessage?topicID=1115.topic http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/mci_7vvt.asp James Powell
5. Re: CD eject
- Posted by Juergen Luethje <jluethje at gmx.de> Jul 17, 2002
- 444 views
Hello Don, Don <Graebel at hotmail.com> wrote: >> I'm wondering if anyone has a code (windows) that will access a CD-ROM >> drive and make it eject.? Thanks! >> > I saw Juergen Luethje's code snip for ejecting a CD using INTs. Very > interesting. If however you would prefer the Windows version of the > same, use this: > ========== > include Win32Lib.ew > constant > winmm = registerw32Library( "winmm.dll" ) > constant > mciSendString = registerw32Procedure( winmm, "mciSendStringA", > {C_POINTER,C_POINTER,C_POINTER,C_POINTER} ) > procedure OpenCD() > atom OpenStr > OpenStr = allocate_string( "Set cdaudio door open wait" ) > w32Proc( mciSendString, {OpenStr, 0, 0, 0} ) > free( OpenStr ) > end procedure > procedure CloseCD() > atom CloseStr > CloseStr = allocate_string( "Set cdaudio door closed wait" ) > w32Proc( mciSendString, {CloseStr, 0, 0, 0} ) > free( CloseStr ) > end procedure > ========== > Don Phillips I would prefer the Windows version, but I only was able to write the DOS version. And of course it's nice not only to have a OpenCD() routine, but also a CloseCD() routine. I've got a question: When a computer has 2 or more CD drives, how do your procedures "know", which drive they should open/close? Thanks and best regards, Juergen
6. Re: CD eject
- Posted by weddle at psknet.com Jul 17, 2002
- 454 views
> > Hello Don, > > Don <Graebel at hotmail.com> wrote: > > >> I'm wondering if anyone has a code (windows) that will access a CD-ROM > >> drive and make it eject.? Thanks! > >> > > > I saw Juergen Luethje's code snip for ejecting a CD using INTs. Very > > interesting. If however you would prefer the Windows version of the > > same, use this: > > > ========== > > include Win32Lib.ew > > > constant > > winmm = registerw32Library( "winmm.dll" ) > > constant > > mciSendString = registerw32Procedure( winmm, "mciSendStringA", > > {C_POINTER,C_POINTER,C_POINTER,C_POINTER} ) > > > procedure OpenCD() > > atom OpenStr > > OpenStr = allocate_string( "Set cdaudio door open wait" ) > > w32Proc( mciSendString, {OpenStr, 0, 0, 0} ) > > free( OpenStr ) > > end procedure > > > procedure CloseCD() > > atom CloseStr > > CloseStr = allocate_string( "Set cdaudio door closed wait" ) > > w32Proc( mciSendString, {CloseStr, 0, 0, 0} ) > > free( CloseStr ) > > end procedure > > ========== > > > Don Phillips > > > I would prefer the Windows version, but I only was able to write the DOS > version. And of course it's nice not only to have a OpenCD() routine, > but also a CloseCD() routine. > > I've got a question: When a computer has 2 or more CD drives, how do > your procedures "know", which drive they should open/close? > > Thanks and best regards, > Juergen I also have the same question, i'm currently using the above code (Thanks Don!!) i have 2 drives, a DVD drive and a CD-R/W drive as well, the above code will only open my DVD drive, which is my primary drive (E: while the cd-rw drive is F:) Is it possible to open a second drive as well?
7. Re: CD eject
- Posted by Juergen Luethje <jluethje at gmx.de> Jul 20, 2002
- 472 views
Don <Graebel at hotmail.com> wrote: <snip> > Well that took a little longer than I expected. Oh well. > mciSendMessage was too generic. Theres no way to specify a drive using > that API. So I changed over to mciSendCommand. Enjoy. <snip> Thanks, Don! Best regards, Juergen