This example will display the size of your hard disk using WMI and C#
Private Sub Form_Load()
‘add a reference to the Microsoft WMI Scripting 1.2 library
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive", , 48)
For Each objItem In colItems
‘Form1.Print "Size: " & objItem.Size / 1024 / 1024 & " megabytes"
MsgBox ("Size: " & objItem.Size / 1024 / 1024 & " megabytes")
Next
End Sub
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.


















