by Tom Putland (3 Submissions)
Category: Windows System Services
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Sat 11th August 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Open And Close CD Drives
API Declarations
Add This In A Module:
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
Dim lngReturn As Long
Dim strReturn As Long
'To open the CD door, use this code:
lngReturn = mciSendString("set CDAudio door open", strReturn, 127, 0)
End Sub
Private Sub Command2_Click()
Dim lngReturn As Long
Dim strReturn As Long
'To close the CD door, use this code:
lngReturn = mciSendString("set CDAudio door closed", strReturn, 127, 0)
End Sub