//Namespace references using System.Text; using System.Runtime.InteropServices;
//Win32 API Call [DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi)] protected static extern int mciSendString(string lpstrCommand,StringBuilder lpstrReturnString,int uReturnLength,IntPtr hwndCallback);
//Method #region Open/Close CD Tray /// /// method to open or close the CD tray based on the /// boolean value passed /// /// /// public bool ProcessCDTray(bool open) { int ret = 0; //do a switch of the value passed switch (open) { case true: //true = open the cd ret = mciSendString("set cdaudio door open", null, 0, IntPtr.Zero); return true; break; case false: //false = close the tray ret = mciSendString("set cdaudio door closed", null, 0, IntPtr.Zero); return true; break; default: ret = mciSendString("set cdaudio door open", null, 0, IntPtr.Zero); return true; break; } } #endregion
|
No responses found. Be the first to respond and make money from revenue sharing program.
|