Solved

Opening/closing CD-Drive

Posted on 1997-03-16
6
177 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 3

Expert Comment

by:sperling
ID: 1334918
 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
ID: 1334919
Edited text of question
0
 

Author Comment

by:OAM
ID: 1334920
Didn't work the way it was suppose to.

Not enough comments (It is a 100 point question)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Expert Comment

by:sperling
ID: 1334921
What OpenParms did you use, and what errors did you get?

Regards,

Erik.
0
 

Author Comment

by:OAM
ID: 1334922
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
ID: 1334923
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

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!

Question has a verified solution.

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

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…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month4 days, 23 hours left to enroll

636 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