Re: CD eject
- Posted by weddle at psknet.com Jul 17, 2002
- 433 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?