Solved

Select one from two CDRom drives

Posted on 2000-03-17
18
269 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

680 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