Opening/Closeing CD tray 1/2 or browseing
I'm trying to do something, and when the user clicks on the open button it well load up a dialog box (that I made) that well ask if the user what's to open his/her CD tray 1 or 2 (if they have 2 cd drives) and one the let's them browse there computer for media files (mpg, avi, mp3, etc.). this is what I got so far:
Look at next post for the picture.
All I need now is the code for doing that and how to I do a form load thing that well scan there drive(s) for the name of the CD drive(s) and howmany there, and if it scans and finds only one, it well hide option2 showing a message that reads "No second CD Drive found" and if it finds the name it well say something like (by the option thing replaceing "Open/Close CD Tray 1" with "Open/Close *name of CD Drive*"):
Open/Close *Name of CD Drive*
Thank you a head of time.
Heres how to get the drive letters
VB Code:
Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
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
Const DRIVE_CDROM = 5
Private Sub Command1_Click()
Dim tmp As Integer
Dim tmpStr As String
Dim Drives As String
Dim CDsCount As Integer 'Number of CD Drives
Dim CDsLetters As String 'Cd Drive Letters
Drives = Space(255)
ret& = GetLogicalDriveStrings(Len(Drives), Drives)
For tmp = 1 To ret& Step 4
tmpStr = Mid(Drives, tmp, 3)
If GetDriveType(tmpStr) = DRIVE_CDROM Then
CDsCount = CDsCount + 1
CDsLetters = CDsLetters & Left(tmpStr, 1) & " "
End If
Next tmp
If CDsCount Then
MsgBox CDsCount, vbInformation, "Number Of CD Drives"
MsgBox CDsLetters, vbInformation, "Letters Of Drives"
Else
MsgBox "No CDs Available"
End If
End Sub