怎样枚举硬盘盘符?

IceMe 2004-01-15 04:55:35
怎样枚举硬盘盘符?
...全文
82 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
hhjjhjhj 2004-01-15
  • 打赏
  • 举报
回复
Sub ShowDriveList()
Dim fs, d, dc, s, n
On Error Resume Next
Set fs = CreateObject("Scripting.FileSystemObject")
Set dc = fs.Drives
For Each d In dc
s = s & d.DriveLetter & " - "
If d.DriveType = 3 Then
n = d.ShareName
Else
n = d.VolumeName
End If
s = s & n & vbCrLf
Next
MsgBox s
End Sub
guoyx 2004-01-15
  • 打赏
  • 举报
回复
Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long

Dim S As String

S = String(256, Chr(0))
GetLogicalDriveStrings Len(S), S

742

社区成员

发帖
与我相关
我的任务
社区描述
VB 版八卦、闲侃,联络感情地盘,禁广告帖、作业帖
社区管理员
  • 非技术类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧