Board index » delphi » Open/Close CD-drive

Open/Close CD-drive

Hello All!

I'm looking for some source code which can Open and Close a CD-Drive. It should
also check if the CD-Drive is already open or closed.

Please help me... I'm beginning to get desperat. ;-)

Kind regards Ole

    E-Mail: Ole_Morten...@Hotmail.com

 

Re:Open/Close CD-drive


Quote
Ole Almind Mortensen wrote:

> Hello All!

> I'm looking for some source code which can Open and Close a CD-Drive. It should
> also check if the CD-Drive is already open or closed.

> Please help me... I'm beginning to get desperat. ;-)

> Kind regards Ole

>     E-Mail: Ole_Morten...@Hotmail.com

Take a look at the Feb 4, 1997 "PC Magazine".  On p. 292
Neil Rubenking (also author or "Delphi Programming
Problem Solver") shows a ~25 line Delphi program that
opens and closes the CD-ROM drawer.

--
Earl F. Glynn          EarlGl...@WorldNet.att.net
EFG Software              913/859-9557  Voice/Fax
   Scientific/Engineering/Medical Applications
             Overland Park, KS  USA

Re:Open/Close CD-drive


Hello "Earl!

Saturday March 08 1997, "Earl F. Glynn" wrote to All:

 EFG> Take a look at the Feb 4, 1997 "PC Magazine".  On p. 292
 EFG> Neil Rubenking (also author or "Delphi Programming
 EFG> Problem Solver") shows a ~25 line Delphi program that
 EFG> opens and closes the CD-ROM drawer.

Since I don't have PC Magazine, maybe you would post the code to me??

If you would send it through E-Mail please you the address below!

Kind regards Ole

    E-Mail: Ole_Morten...@Hotmail.com

Re:Open/Close CD-drive


In article <0a9_9703080...@night.ping.dk>, Ole.Almind.Morten...@p150.f10.n237.z2.fidonet.org (Ole Almind Mortensen) wrote:

Quote
>Hello All!

>I'm looking for some source code which can Open and Close a CD-Drive. It should
>also check if the CD-Drive is already open or closed.

>Please help me... I'm beginning to get desperat. ;-)

I use mciSendString (uses MMSystem) for this purpose.  It's not as
fast as mciSendCommand but in this case it doesn't matter.

var mciError: integer; mciReturn, mciErrorMsg: array[0..127] of char;
PmciReturn, PErrorMsg: PChar;
begin
     { check for presence of CD }
     PmciReturn := @mciReturn;
     mciError := mciSendString('status CDAudio media present',
           PmciReturn, 127, 0);
     if StrUpper( mciReturn)='TRUE' then dosomething
..
     { close cd door }
     mciError := mciSendString('set CDAudio door closed',
           PmciReturn, 127, 0);

     { open cd door }
     mciError := mciSendString('set CDAudio door open',
           PmciReturn, 127, 0);

     You may also want to check to see whether mciError<>0 (there is
an error), call mciErrorMessage to get the error string for the given
error code, e.g.,

     PErrorMsg := @mciErrorMsg;
     if mciError<>0 then mciGetErrorString( mciError,PErrorMsg, 127);

     As for checking whether the drive door is open or closed, I have
no idea.  I know 'status cdaudio ready' returns false if door is open.
 But it also returns false if there's no cd in the drive.

      Note: I'm still learning Delphi so my code is probably not all
kosher.  I hope someone will correct me if there's anything amiss.

-- luu

Re:Open/Close CD-drive


Hello Luu!

Tuesday March 11 1997, Luu Tran wrote to All:

 LT> I use mciSendString (uses MMSystem) for this purpose.  It's not as
 LT> fast as mciSendCommand but in this case it doesn't matter.

 LT>       Note: I'm still learning Delphi so my code is probably not all
 LT> kosher.  I hope someone will correct me if there's anything amiss.

It worked just fine, so thank you for you help. :)))

Kind regards Ole

    E-Mail: Ole_Morten...@Hotmail.com

Re:Open/Close CD-drive


On 07 Mar 97 18:04:24 ,
Ole.Almind.Morten...@p150.f10.n237.z2.fidonet.org (Ole Almind
Mortensen) asked about code to open, close, check CD-ROM drives.

It is covered in 'Borland Delphi: How-To' by the Waite Group.

http://ourworld.compuserve.com/homepages/TK_Boyd/homepage.htm
Freeware, shareware for IBM type pcs. Ideas for parents, teachers

Re:Open/Close CD-drive


Hello TK!

Thursday March 13 1997, TK Boyd wrote to All:

 TB> It is covered in 'Borland Delphi: How-To' by the Waite Group.

Well soon I have to buy about 100 books! Can't you write the code instead of a
book in which I can find the answer??

Kind regards Ole

    E-Mail: Ole_Morten...@Hotmail.com

Re:Open/Close CD-drive


In article <139_9703142...@night.ping.dk>, Ole.Almind.Morten...@p150.f10.n237.z2.fidonet.org (Ole Almind Mortensen) wrote:

Quote
>Hello TK!

>Thursday March 13 1997, TK Boyd wrote to All:

> TB> It is covered in 'Borland Delphi: How-To' by the Waite Group.

>Well soon I have to buy about 100 books! Can't you write the code instead of a
>book in which I can find the answer??

>Kind regards Ole

>    E-Mail: Ole_Morten...@Hotmail.com

checkout my site. There is tons f info there and from the about pages
downloadable for free.

The Graphical Gome      (r...@ktibv.nl)

Senior Software Engineer

--------------------------------------------------------------------------------------------------------------
Delphi developers FAQ at http://www.gnomehome.demon.nl/uddf/index.htm
Non frame version     at  http://www.gnomehome.demon.nl/uddf/indexnf.htm

Other Threads