Solved

Select one from two CDRom drives

Posted on 2000-03-17
18
268 Views
Last Modified: 2010-04-04
Hy,
I have two CD-ROM drives : E:\ and F:\
My default drive is E:\ .
How can I select my second drive for open and close the door or play .
0
Comment
Question by:ginsonic
  • 6
  • 4
  • 4
  • +1
18 Comments
 
LVL 17

Expert Comment

by:inthe
ID: 2627142
Hi
look to this:
http://www.delphipages.com

and type tcdevents in the search box.
this is zifnabs cd component which you can use to change default drives .
(comes with full sources)


description:
This component will notify you when the user inserts/removes a CD from the CD-rom drive by pushing the eject button. Next to this some other usefull CD related options are available, like enabling/disabling autorun (CD & audio CD), changing the default cd-player, ...

Regards Barry
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2627189
Nick,

Just do this

MediaPlayer1.FileName := 'F:';

You can now just use the TMediaPlayer component like before. No extra components, no extra codes, no larger EXEs etc.

The Neil
0
 
LVL 9

Author Comment

by:ginsonic
ID: 2627246
Hy Inthe ,
I can't install CDEvents in my D4 .
I installed but I haven't the classes in my compiler. TCDEvents and .... I don't remember now .
I love ideea , but I can't use it .

Hello Neil ,
How do you do ? :)
I don't wish to use TMediaPlayer .

I wish to put a CD player in my new broadcasting scheduler and I want to use API functions .
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 5

Expert Comment

by:TheNeil
ID: 2627284
Nick,

I'm doing fine. You?

Oops, I assumed you were using the TMediaPlayer component. I've never gone down and used the API to do this kind of thing and using a TMediaPlayer is the way Borland suggest you open the CD drive (not that that makes it right). All I can suggest (if you don't (or can't) use Barry's component) is hunting through the MPlayer.PAS file and seeing how the TMediaPlayer component handles an eject. I've had a quick look and it's just an MCI call BUT I couldn't see how to set the 'active' drive - sorry. The TMediaplayer approach DOES work so it should just be a case of figuring out HOW it's doing it by looking at what gets set when you set the filename (as I suggested), and how that stored value is applied to an eject.

The Neil =:)
0
 
LVL 9

Author Comment

by:ginsonic
ID: 2627455
How I know the TMediaPlayer can only open the door .
0
 
LVL 17

Expert Comment

by:inthe
ID: 2627579
for mediaplayer set the filename as "the neil" said then something like

var
handle : thandle;
begin
handle := mediaplayer1.deviceid;

//To Open:
 mciSendString('Set cdaudio door open wait', nil, 0, handle);
//To Close:
 mciSendString('Set cdaudio door closed wait', nil, 0, handle);

Make sure to include the MMSystem unit in your uses clause.
thats untested  btw so may not work.

ps i email zifnab to look here as maybe he can help in install of his component..
i tried and too had problem(no component appeared on pallete?) , although i remember i had it installed no problem in d3.

0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2627623
Barry,

You might not have tested it but it certainly works (I just gave it a try and it works on my machine)

The Neil =;)
0
 
LVL 17

Expert Comment

by:inthe
ID: 2627655
ahh great
i knew the open and close worked for me once but i couldnt remember what to use for handle and coulnt see any thing else from deviceid.
thanks for saying ,i can save this in my code snippet database.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 2627811
Hi,

mmm, which version of TCDevents are you using? urgh, this is already a long time that I looked at this component... I think I should make a BIG update.

I know that from a certain version, you don't have to use the reg file, but the source-code files itself (register the products itself).  Does not use the seperate reg file to install the components

Tom.
0
 
LVL 17

Expert Comment

by:inthe
ID: 2627854
1.41 was only version i could find
(delphipages and dsp)today but i was sure it was newer version i had installed in d3.
i wait for ginsonic see what he found,
0
 
LVL 9

Author Comment

by:ginsonic
ID: 2627974
I know the API commands to open or close the door . I see many tips on net .

I use :
mciSendString('Set cdaudio door open wait', nil, 0, 0);
My problem is how to open or close the second CDROM door .
With this command I close or open the default CDROM .
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2627993
Nick,

What you need to do is use a TMediaPlayer component (You don't have to open it or use it though). You set the drive as I described earlier THEN you can use mciSendString(...). If you want to get away from TMediaPlayer then try hunting through the TMediaPlayer source code and see what it does when you set the filename

The Neil
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 2628022
You can find the latest at Torries (1.44)
0
 
LVL 9

Author Comment

by:ginsonic
ID: 2628577
Hy ZifNab .
I try to find 1.44 on Torries , but...
Version 1.42 don't work for me . Can U send me a mail with this ?

Regards,
Nick
0
 
LVL 9

Author Comment

by:ginsonic
ID: 2628600
Hy ZifNab .
I try to find 1.44 on Torries , but...
Version 1.42 don't work for me . Can U send me a mail with this ?

Regards,
Nick
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 2631725
Hi ginsonic,

what is your e-mail address? I'll send you the latest version. (rather old)

zif.
0
 
LVL 9

Author Comment

by:ginsonic
ID: 2632833
Thanks Zifnab,
My email is nick@radioterra.ro .
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 25 total points
ID: 2637262
you should reveive it very soon.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question