|
i want to use class Win32_DefragAnalysis(WMI) to scan status of other volume, but it is not active, exactly, the For-each is not work, please help me,
<pre lang="vb">Private Sub defrag_analysis()
On Error Resume Next
Dim item
Dim nameSQL
Dim wmiOBJECT
Dim itemCOLLECTION
Set wmiOBJECT = GetObject("Winmgmts:\\.\root\cimv2")
nameSQL = "select * from Win32_DefragAnalysis" ' Where VolumeSize > 0 "
Set itemCOLLECTION = wmiOBJECT.ExecQuery(nameSQL)
For Each item In itemCOLLECTION
'not print properties of item
MsgBox "VolumeSize : " & item.VolumeSize
MsgBox "Name : " & item.VolumeName
MsgBox "FreeSpace :" & item.FreeSpace
MsgBox "AverageFileSize : " & item.AverageFileSize
Next
MsgBox "jump here"
End Sub
</pre>
|
|
|
|
|
Since when does VB6 have a "for-each"? Did I mention it's a dead language? Why are you still using it?
The VB.NET IDE is available for free, as is the runtime. I strongly suggest you switch your platform.
|
|
|
|