I know how to open and close a CD-ROM Drive. I've posted the code here.
Code:
Option Base 1
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
Sub main()
' CD Open/Close Program
' -Sanchit Karve
' You are allowed to distribute this code without making
' changes to it.
' -Sanchit Karve
' born2c0de@hotmail.com
Dim Now As String
Dim a(2) As String
a(1) = "set cdaudio door open"
a(2) = "set cdaudio door closed"
total = 1 'Set this to the number of cycles you want it to undergo
For i = 1 To (total * 2)
If Int(i / 2) = i / 2 Then
Now = vbString(a(2), 0)
Else
Now = vbString(a(1), 0)
End If
Next i
End Sub
Function vbString(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)
vbString = Buff
End Function
But what if someone has more than 1 CD Drives...how can we open each drive then?