This works with Strict Off
But not with Strict On
Sometimes I can figure out what is needed by running it and using QuickWatch
to see the type required but
GetObject("winm gmts:\\" & StrComputer & "\root\cimv 2")
returns a value System._ComObje ct of Type Object
I don't know what to make of that.
Do you know how to fix this code?
thanks in advance
Dim StrComputer As String = "."
Dim ObjWMIService As Object = GetObject("winm gmts:\\" & StrComputer &
"\root\cimv 2")
Dim ColItems As Object = ObjWMIService.E xecQuery("Selec t * from
Win32_Processor ")
For Each objItem As Object In ColItems
Console.WriteLi ne("L2 Cache Size: " & objItem.L2Cache Size)
Console.WriteLi ne("L2 Cache Speed: " & objItem.L2Cache Speed)
Console.WriteLi ne("Current Voltage: " & objItem.Current Voltage / 10.0)
Console.WriteLi ne("Maximum Clock Speed: " & objItem.current ClockSpeed)
Next
But not with Strict On
Sometimes I can figure out what is needed by running it and using QuickWatch
to see the type required but
GetObject("winm gmts:\\" & StrComputer & "\root\cimv 2")
returns a value System._ComObje ct of Type Object
I don't know what to make of that.
Do you know how to fix this code?
thanks in advance
Dim StrComputer As String = "."
Dim ObjWMIService As Object = GetObject("winm gmts:\\" & StrComputer &
"\root\cimv 2")
Dim ColItems As Object = ObjWMIService.E xecQuery("Selec t * from
Win32_Processor ")
For Each objItem As Object In ColItems
Console.WriteLi ne("L2 Cache Size: " & objItem.L2Cache Size)
Console.WriteLi ne("L2 Cache Speed: " & objItem.L2Cache Speed)
Console.WriteLi ne("Current Voltage: " & objItem.Current Voltage / 10.0)
Console.WriteLi ne("Maximum Clock Speed: " & objItem.current ClockSpeed)
Next
Comment