Solved

Opening/closing CD-Drive

Posted on 1997-03-16
6
170 Views
Last Modified: 2010-04-04
I know how to open and close a CD-drive, but I like to be able to choose between two available drives. How do I choose which device to open with MciSendCommand??

CD-Drives: F and G

I need to know how to open G
0
Comment
Question by:OAM
  • 3
  • 3
6 Comments
 
LVL 3

Expert Comment

by:sperling
Comment Utility
 FillChar(OpenParms, SizeOf(OpenParms), 0);
  OpenParms.lpstrDeviceType :=
    POINTER(MCI_DEVTYPE_CD_AUDIO + 1 shl 16);

// High word is device number      ^

  Error := mciSendCommand(MCI_DEVTYPE_CD_AUDIO,
    MCI_OPEN,
    MCI_OPEN_TYPE or MCI_WAIT
   
    or MCI_OPEN_TYPE_ID
// Indicate that we specify an device number  

    or MCI_OPEN_SHAREABLE,
    INTEGER(@OpenParms));


This code should work according to my docs.
I cannot test it, as I ain't got any machines with to CD's...

Erik.
0
 

Author Comment

by:OAM
Comment Utility
Edited text of question
0
 

Author Comment

by:OAM
Comment Utility
Didn't work the way it was suppose to.

Not enough comments (It is a 100 point question)
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 3

Expert Comment

by:sperling
Comment Utility
What OpenParms did you use, and what errors did you get?

Regards,

Erik.
0
 

Author Comment

by:OAM
Comment Utility
Well I't didn't work.

OpenParms.lpstrDeviceType :=                                          POINTER(MCI_DEVTYPE_CD_AUDIO + 1 shl 16);

It is not too clear to me what this is suppose to do.



0
 
LVL 3

Accepted Solution

by:
sperling earned 100 total points
Comment Utility
procedure TForm1.Button1Click(Sender: TObject);
var
  Error      : INTEGER;
  a          : ARRAY [0..199] OF CHAR;
begin
  Error := mciSendString('open cdaudio1', a, SizeOf(a), 0);
  mciGetErrorString(Error, a, SizeOf(a));
  Label1.Caption := StrPas(a);
end;

This should work.

> POINTER(MCI_DEVTYPE_CD_AUDIO + 1 shl 16)

According to docs, the high-order word of this pointer indicates the ordinal number of the device. "X shl 16" sets the high order word to X... But then, it didn't work... Kind of hard to find this out, as I haven't got two of any MCI devices on any of my pcs...


Regards,

Erik.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

18 Experts available now in Live!

Get 1:1 Help Now