'引用Microsoft WMI Scripting 1.1 Library
'在窗体上建一个Text,命名为Text1,并且
'Text1.MultiLine = True
Private Sub GetProcessorID()
Dim a As SWbemServices
Dim b As SWbemObjectSet
Dim c As SWbemObject
Dim d As SWbemPropertySet
Dim e As SWbemProperty
Set a = GetObject("winmgmts:")
Set b = a.InstancesOf("Win32_Processor")
For Each c In b
With c
If .Properties_.Count > 0 Then
Set d = .Properties_
For Each e In d
Text1 = Text1 & e.Name & ": " & e.Value & vbCrLf
Next
End If
End With
Next
End Sub
Private Sub Command1_Click()
Call GetProcessorID
End Sub
该博客展示了引用Microsoft WMI Scripting 1.1 Library获取处理器信息的代码。通过在窗体上创建文本框,编写GetProcessorID函数获取Win32_Processor实例的属性信息,并在点击按钮时调用该函数将信息显示在文本框中。
1万+

被折叠的 条评论
为什么被折叠?



