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()And now for module section, just copy and paste the following code or the code can be copied from the API.
'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
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.
the retvalue and returnstring has not been defined
ReplyDelete