# Re: 如何寻找光碟机所在路径?

Posted by 刘柏泛 on May 10, 1998 at 17:53:06:

In Reply to: 如何寻找光碟机所在路径? posted by snow on May 09, 1998 at 09:52:17:

使用 Drive 物件
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
End Sub
这样目录即会转至光碟机，程式的部份有问题请自行修改

Follow Ups: