Y
yxq
Hello,
I want to get some system info using WMI class, but there are two ways, i
want to know what different between them, thank you.
The first:
******************************************
Dim info As ManagementObject
Dim search As ManagementObjectSearcher
search = New ManagementObjectSearcher("SELECT * From
Win32_OperatingSystem")
For Each info In search.Get()
Messagebox.Show info("Caption")
Next
The Second:
*******************************************
Public objWMI As Object
Public colItems As Object
Public objItem As Object
objWMI = GetObject("WinMgmts:/root/cimv2")
colItems = objWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem")
For Each objItem In colItems
Messagebox.Show objItem.Caption
Next
I want to get some system info using WMI class, but there are two ways, i
want to know what different between them, thank you.
The first:
******************************************
Dim info As ManagementObject
Dim search As ManagementObjectSearcher
search = New ManagementObjectSearcher("SELECT * From
Win32_OperatingSystem")
For Each info In search.Get()
Messagebox.Show info("Caption")
Next
The Second:
*******************************************
Public objWMI As Object
Public colItems As Object
Public objItem As Object
objWMI = GetObject("WinMgmts:/root/cimv2")
colItems = objWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem")
For Each objItem In colItems
Messagebox.Show objItem.Caption
Next