Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ejecting CD-ROM

Status
Not open for further replies.

imagenetics

Programmer
Dec 8, 2003
66
PL
There is a combo-box in my program listing all available CD-ROM drives, by their letters (D:\, E:\, F:\, ...). I wish to add a button which will eject the selected drive. I know there is a mciSendString() to do this but no matter which drive I select in the combo, my audio drive is ejected every time. Is there a way to eject certain CD-ROM drive based on its letter?
 
You might want to look at the TMediaPlayer. It encapsulates the mciSendString() and will allow you to select which drive to eject.


James P. Cottingham
-----------------------------------------
To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.
 
Do you mind elaborating on that? What should I do? I'll appreciate a code example. Thanks.
 
You can create a new media player or drop the component on your form. The your code might look something like this:
Code:
MediaPlayer1->DeviceType = dtCDAudio; // I think this must be set to something
// Look at the help for the different devices.
MediaPlayer1->FileName = "D:"; // For example, maybe D:\*.*
MediaPlayer1->Open();
MediaPlayer1->Eject();
MediaPlayer1->Close();

I'm going from memory here, so watch out!

James P. Cottingham
-----------------------------------------
To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.
 
That doesn't seem to work exactly as I expect, but thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top