C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Operating System »

Open or close the CD drive


Posted Date: 08 Aug 2009    Resource Type: Code Snippets    Category: Operating System
Author: Shunmuganathan MMember Level: Diamond    
Rating: 1 out of 5Points: 7



Description :


We can open and close the tray of the CD drive of the system.

Following are the namespaces


using System.Runtime.InteropServices;
using System.Text;


Following is the DLL import part.

[DllImport("winmm.dll", EntryPoint="mciSendStringA", CharSet=CharSet.Ansi)]
protected static extern int MymciSendString
(string mciCommand,
StringBuilder returnValue,
int returnLength,
IntPtr callback);



Following is the code part to open and close the CD drive

public static void Main( )
{
int result = MymciSendString
("open the door ", null, 0, IntPtr.Zero);
result = MymciSendString ("close the door",
null, 0, IntPtr.Zero);
}



By
Nathan



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
CD drive  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Environment Class in C#
Previous Resource: Get the OS version
Return to Discussion Resource Index
Post New Resource
Category: Operating System


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use