+92 332 4229 857 99ProjectIdeas@Gmail.com

Cd-Rom Opening and Closing (C#.net)

Cd-Rom Opening And Closing:
The following program shows you how to open and close the cd-rom.


using System.Runtime.InteropServices;

 ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
public static extern long mciSendString(string lpCommandString, string lpReturnString, long uReturnLength, long hwndCallback);
public void btnOpen_Click(System.Object sender, System.EventArgs e)
       mciSendString("set CDAudio door open", "", 0, 0);
public void btnClose_Click(System.Object sender, System.EventArgs e)
       mciSendString("set CDAudio door closed", "", 0, 0);