Okay guys i was doing a program about managing the system things so i had to figure out eject and closing CD/DVD Drive so i did and here is the code for this .
first of all you need to import a interop service it's
now to close CD/DVD Drive use this code
Hope it helped you ..
first of all you need to import a interop service it's
[DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi)] protected static extern int mciSendString(string lpstrCommand, StringBuilder lpstrReturnString, int uReturnLength, IntPtr hwndCallback);after importing it add the namespace using System.Runtime.InteropServices; , then add this code to eject CD/DVD Drive
int ret = mciSendString("set cdaudio door open", null, 0, IntPtr.Zero);
now to close CD/DVD Drive use this code
int ret = mciSendString("set cdaudio door closed", null, 0, IntPtr.Zero);
Hope it helped you ..
3 comments
Hey Can we create a textbox like fb?
ReplyI mean : where we can use smilies in textbox
i am not that good at css and web developments indeed
ReplyThank you man, this code was very helpfull for me.
ReplyCan u explain in detail the sintax of this pieces of code??....
Post a Comment
Note: Only a member of this blog may post a comment.