Solved

Select one from two CDRom drives

Posted on 2000-03-17
18
264 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 5

Expert Comment

by:TheNeil
Comment Utility
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
Comment Utility
How I know the TMediaPlayer can only open the door .
0
 
LVL 17

Expert Comment

by:inthe
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 17

Expert Comment

by:inthe
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
You can find the latest at Torries (1.44)
0
 
LVL 9

Author Comment

by:ginsonic
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks Zifnab,
My email is nick@radioterra.ro .
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 25 total points
Comment Utility
you should reveive it very soon.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now