Взимане на информация за процесор във Visual Basic чрез класа Win32_Processor.
Информацията се показва в DataGridView с име CPUInfo.
Imports System.Management | |
Public Class Main | |
Private Sub appLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load | |
With CPUInfo | |
.Columns.Add("Name", "Name") | |
.Columns.Add("Value", "Value") | |
End With | |
Dim search As New ManagementObjectSearcher("SELECT * FROM Win32_Processor") | |
Dim result As ManagementObjectCollection = search.Get() | |
For Each item As ManagementObject In result | |
For Each data As PropertyData In item.Properties | |
CPUInfo.Rows.Add(data.Name, data.Value) | |
Next data | |
Next item | |
End Sub | |
End Class |