[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Control the CD Tray with C#

Posted on 2004-09-13
3
Medium Priority
?
433 Views
Last Modified: 2008-03-03
I want to write a program to control my CD tray . To make it in and out . Eject and back. I triead to check the msdn but couldn't find what I wanted. Does any body know the class we can use for that task ?
If any other ideas or tips are available please mention.
0
Comment
Question by:drtoto82
[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
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
Fahad Mukhtar earned 500 total points
ID: 12051455
you can use the mciSendString API for this

using System.Runtime.InteropServices;
 
[DllImport("winmm", EntryPoint="mciSendStringA")]
private static extern int mciSendString(string lpszCommand,  string lpszReturnString, int cchReturnLength, int hwndCallback);


         private void button1_Click(object sender, System.EventArgs e)
         {
              mciSendString("Set cdaudio door open wait", "", 0, 0);
         }

         private void button2_Click(object sender, System.EventArgs e)
         {
           mciSendString("Set cdaudio door closed wait", "", 0, 0);
         }
0
 
LVL 5

Author Comment

by:drtoto82
ID: 12052123
Your reply was perfect. I just had the idea but was messed up in my mind. The thing I want to ask you here, how can I get that data about the dll I am importing and refering to like the one you used winmm,dll ? Sounds foolish , but I always used my dlls and declared everything as public and of course I know the code I wrote for my self.
0
 
LVL 19

Expert Comment

by:Fahad Mukhtar
ID: 12052145
you mean all the functions(APIs) information in that winmm.DLL (or any DLL) ? through a C# program?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Progress
Starting up a Project

650 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