Hi there, are there any code wizards out there that can tell me how to open and close the CD-ROM drive?
Rohan
Printable View
Hi there, are there any code wizards out there that can tell me how to open and close the CD-ROM drive?
Rohan
RohanWest,
Hope this helps...
Option Explicit
Dim dooropen As Boolean
Private Declare Function mciSendString Lib "winmm.dll" _
Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal _
pstrReturnString As String, ByVal uReturnLength As Long, ByVal _
wndCallback As Long) As Long
Private Sub cmdClose_Click()
Dim lRet As Long
Dim sRet As Long
If dooropen Then
lRet = mciSendString("set CDAudio door open", sRet, 127, 0)
dooropen = False
Else
lRet = mciSendString("set CDAudio door closed", sRet, 127, 0)
End If
End Sub
Private Sub cmdOpen_Click()
Dim lRet As Long
Dim sRet As Long
If dooropen Then
lRet = mciSendString("set CDAudio door closed", sRet, 127, 0)
dooropen = True
Else
lRet = mciSendString("set CDAudio door open", sRet, 127, 0)
End If
End Sub