?
Solved

address cd-rom driver in C++

Posted on 1999-01-06
19
Medium Priority
?
188 Views
Last Modified: 2013-12-03
I want to know how I can address the cd-rom drive using it's windows driver in C++
For example I want to open the cd-rom player and close it after a certain delay.
Does anyone know where to get documentation of it.
0
Comment
Question by:TheMaster
[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
  • 11
  • 8
19 Comments
 
LVL 11

Expert Comment

by:alexo
ID: 1418159
Check the mciSendCommand() function with the MCI_SET parameter.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1418160
Or mciSendString() command.
0
 

Author Comment

by:TheMaster
ID: 1418161
what header file do I need for it?
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 11

Expert Comment

by:alexo
ID: 1418162
#include <mmsystem.h>

And link with winmm.lib
0
 

Author Comment

by:TheMaster
ID: 1418163
what header file do I need for it?
0
 

Author Comment

by:TheMaster
ID: 1418164
Don't you want the points? because you just gave some comment.
0
 
LVL 11

Accepted Solution

by:
alexo earned 1000 total points
ID: 1418165
>> Don't you want the points? because you just gave some comment.
I wasn't sure that the answer I gave is really what you need so I refrained from locking the question.  I assumed (obviously correctly) that you will tell me if my answer is helpful.  I'm locking it now.
0
 

Author Comment

by:TheMaster
ID: 1418166
What arguments do I have to give with the function?
0
 
LVL 11

Expert Comment

by:alexo
ID: 1418167
To open the door:
  mciSendString("set cdaudio door open wait", NULL, 0, NULL);

To close the door:
  mciSendString("set cdaudio door closed wait", NULL, 0, NULL);

0
 

Author Comment

by:TheMaster
ID: 1418168
That might work, do you know where I can see how those options work, some documentation on mmsystem.h.
Because I've checked the help files at home, but they didn't say anything about mmsystem.h
0
 
LVL 11

Expert Comment

by:alexo
ID: 1418169
Sorry, my mistake.  The command needs an output buffer so try this:

    #pragma warning(disable: 4201 4514)
    #pragma comment(lib, "winmm.lib")

    #define STRICT
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #include <mmsystem.h>

    void main()
    {
        char buff[128];
        mciSendString("set cdaudio door open wait", buff, sizeof buff, NULL);
    }

0
 
LVL 11

Expert Comment

by:alexo
ID: 1418170
>> documentation on mmsystem.h
What compiler do you use?
0
 
LVL 11

Expert Comment

by:alexo
ID: 1418171
For online info, go to:
http://premium.microsoft.com/isapi/devonly/prodinfo/msdnprod/msdnlib.idc?theURL=/msdn/library/sdkdoc/multimed/mci_7vvt.htm

(The first access of MSDN-online will require a one-time registration process)

0
 

Author Comment

by:TheMaster
ID: 1418172
I'm using Borland c++ 5 and Borland c++ builder.
But I think i'll be using c++Builder for this.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1418173
I don't have BC++ at home, I'll check its documentation at work (sunday).
Meanwhile you can check the online info.

OK?
0
 

Author Comment

by:TheMaster
ID: 1418174
I can open the cdrom door, but now I want to close it again.
Did you by the way find any docs?
0
 
LVL 11

Expert Comment

by:alexo
ID: 1418175
>> I can open the cdrom door, but now I want to close it again.
mciSendString("set cdaudio door closed wait", buff, sizeof buff, NULL);

>> Did you by the way find any docs?
Yes.  BC5.02 has a "Multimedia API Reference" help file.  Check the "MCI" topic and subtopics.

BTW, How about grading the answer?
0
 

Author Comment

by:TheMaster
ID: 1418176
I've tried mciSendString("set cdaudio door closed wait", buff, sizeof buff, NULL);
But it won't close.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1418177
Docs say it should work.  Don't have a CDROM to test it.  Checked the return value?
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

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

762 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