# Re: 如何只显示CD-Rom Driver??

Posted by 小刘 on January 30, 1998 at 20:44:07:

In Reply to: 如何只显示CD-Rom Driver?? posted by RPG之鬼 on January 30, 1998 at 19:17:21:

先宣告
Private Declare Function GetDriveType Lib "kernel32" Alias
"GetDriveTypeA" (ByVal nDrive As String) As Long

之后…
Private Sub Form_Load()
Dim I As Integer
Dim DriverPath As String
Dim ret As Long

For I = 0 To Drive1.ListCount
DriverPath = Left(Drive1.List(I), 2) + "\"
ret = GetDriveType(DriverPath)
If ret = 5 Then Drive1.ListIndex = I
Next I
Drive1.Enabled = False

End Sub
如果可以指定磁碟机的话，就把Loop拿掉。

Follow Ups: