Here's a simple bit of code, but watch out - lots of people have multiple CD drives (CD reader & writer, or CD and DVD), so you should allow for that in your code...
VB Code:
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long For i = 1 to 26 Select Case GetDriveType(chr(64+i) & ":\") Case 2 ' "Removable" Case 3 ' "Drive Fixed" Case 4 ' "Remote" Case 5 ' "Cd-Rom" ' do something here! msgbox chr(64+i) & "is a CD drive" Case 6 ' "Ram disk" Case Else ' "Unrecognized" End Select Next i




Reply With Quote