Controlling the CD/DVD Drive of our computer using an application software is good for both the life of CD/DVD Drive and for us also.
Visual Basic cab be the most easy way to do it.
All you have to do is make a new project.
Add a form and a module and design the interface as you like for eject and close command button.
Name the command Box names as cmdclose and cmdopen for Close and Open Command button.
Private Sub cmdclose_Click() 'Close CD drive door retvalue = mciSendString("set CDAudio door closed", returnstring, 127, 0) End Sub Private Sub cmdopen_Click() 'Open CD drive door retvalue = mciSendString("set CDAudio door open", returnstring, 127, 0) End Sub
And now for module section, just copy and paste the following code or the code can be copied from the API.
Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
You can download the exe file here.