Function GetDrive() As String
'引用:Microsoft Scripting Runtime
'功能:返回驱动器字符串。
'示例:me.驱动器列表.RowSource="驱动器;网络共享名;类型;空间;可用空间;" & GetDrive 列表框或组合框列标题选是
Dim myFSO As New FileSystemObject
Dim myDr As Drive
Dim t As String
For Each myDr In myFSO.Drives
If myDr.IsReady = True Then
Select Case myDr.DriveType
Case 0: t = "Unknown"
Case 1: t = "Removable"
Case 2: t = "Fixed"
Case 3: t = "Network"
Case 4: t = "CD-ROM"
Case 5: t = "RAM Disk"
End Select
GetDrive = GetDrive & myDr.DriveLetter & ":;" & myDr.ShareName & ";" & t & ";"
GetDrive = GetDrive & myDr.TotalSize / 1024 & ";" & myDr.FreeSpace / 1024 & ";"
End If
Next myDr
End Function