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