Snippet
Private 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
Function CDDriveOperation(ByVal Command As String, ByVal hWnd As Long) As String
Dim Buff As String
Dim dwR As Long
Buff = Space$(100) ' Create a buffer
dwR = mciSendString(Command, ByVal Buff, Len(Buff), hWnd)
CDDriveOperation = Buff
End Function
'Call this Sub to Close the CD Door
Private Sub CloseCDDoor()
Dim ret As String
ret = CDDriveOperation("set cdaudio door closed", 0)
End Sub
' Call this Sub to Open the CD Door
Private Sub OpenCDDoor()
Dim ret As String
ret = CDDriveOperation("set cdaudio door open", 0)
End Sub
Copy & Paste
|