VB如何获取硬盘个数?
如题,谢谢
[解决办法]
Private Sub Form_Load()
Dim i As Integer
On Local Error Resume Next
Set wmiObjSet = GetObject( "winmgmts:{impersonationLevel=impersonate} ").InstancesOf( "Win32_DiskDrive ")
For Each obj In wmiObjSet
Debug.Print "标题 "; obj.Caption
Debug.Print "描述: "; obj.Description
Debug.Print "分区个数: "; obj.Partitions
Debug.Print "容量: "; obj.Size
i = i + 1
Next
Debug.Print "共有硬盘 " & i & "块 "
End Sub