🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
6 messages
6 total messages Started by Christophe Minetti Tue, 03 Jun 2008 09:33
How to eject CD tray
#294
Author: Christophe Minetti
Date: Tue, 03 Jun 2008 09:33
7 lines
932 bytes
Hi all,

What is the command to eject the CD-Rom tray ?

Many thanks in advance

Christophe
Re: How to eject CD tray
#295
Author: Jason Cipriani
Date: Tue, 03 Jun 2008 14:16
20 lines
1441 bytes
"Christophe Minetti" <cminetti@ulb.ac.be> wrote in message 
news:48450FE9.6260731F@ulb.ac.be...
> What is the command to eject the CD-Rom tray ?

You want mciSendString:

http://msdn.microsoft.com/en-us/library/ms709492(VS.85).aspx

Use the "set" command:

http://msdn.microsoft.com/en-us/library/ms709492(VS.85).aspx

Example:

#include <mmsystem.h>
void __fastcall TForm2::Button1Click(TObject *Sender) {
    mciSendString("set cdaudio door open", NULL, 0, NULL);
}

Jason 
Re: How to eject CD tray
#297
Author: Jason Cipriani
Date: Tue, 03 Jun 2008 14:19
9 lines
1283 bytes
"Jason Cipriani" <jason.cipriani@nospam-gmail.com> wrote in message 
news:48455251@newsgroups.borland.com...
> Use the "set" command:
>
> http://msdn.microsoft.com/en-us/library/ms709492(VS.85).aspx

I'm sorry that link should be:

http://msdn.microsoft.com/en-us/library/ms713255(VS.85).aspx
Re: How to eject CD tray
#298
Author: Christophe Minetti
Date: Tue, 03 Jun 2008 14:44
15 lines
1359 bytes
Thanks

Christophe

Jason Cipriani wrote:

> "Jason Cipriani" <jason.cipriani@nospam-gmail.com> wrote in message
> news:48455251@newsgroups.borland.com...
> > Use the "set" command:
> >
> > http://msdn.microsoft.com/en-us/library/ms709492(VS.85).aspx
>
> I'm sorry that link should be:
>
> http://msdn.microsoft.com/en-us/library/ms713255(VS.85).aspx
Re: How to eject CD tray
#302
Author: Colin B Maharaj
Date: Wed, 04 Jun 2008 10:54
34 lines
2031 bytes
Interesting question, however I installed an application
by a customer recently and the setup program had an option
to eject the CD.

The Customer has 2 CD drives and the eject process ejected
the other closed CD ROM drive (heh heh) :)

Question: How to tell which drive you are in and relate it
the the drive you are ejecting...


Jason Cipriani wrote:
> "Christophe Minetti" <cminetti@ulb.ac.be> wrote in message 
> news:48450FE9.6260731F@ulb.ac.be...
>> What is the command to eject the CD-Rom tray ?
> 
> You want mciSendString:
> 
> http://msdn.microsoft.com/en-us/library/ms709492(VS.85).aspx
> 
> Use the "set" command:
> 
> http://msdn.microsoft.com/en-us/library/ms709492(VS.85).aspx
> 
> Example:
> 
> #include <mmsystem.h>
> void __fastcall TForm2::Button1Click(TObject *Sender) {
>     mciSendString("set cdaudio door open", NULL, 0, NULL);
> }
> 
> Jason 
> 
> 
Re: How to eject CD tray
#304
Author: Bob Gonder
Date: Wed, 04 Jun 2008 15:59
21 lines
1733 bytes
Colin B Maharaj wrote:

>Interesting question, however I installed an application
>by a customer recently and the setup program had an option
>to eject the CD.
>
>Question: How to tell which drive you are in and relate it
>the the drive you are ejecting...

I usually think DeviceIoControl() which uses a
CreateFile() handle, so it's easy to relate.

As to which drive, GetModuleFileName() should
contain the drive letter.
GetCommandLine() should also have the drive letter.

Here is a Delphi version using DeviceIoControl
http://delphi.newswhat.com/geoxml/forumhistorythread?groupname=borland.public.delphi.nativeapi.win32&messageid=412e698d@newsgroups.borland.com

And an old, much less complete C++
http://groups.google.com/group/borland.public.cppbuilder.winapi/browse_thread/thread/bb0df3d6c2fd135c
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads