我的 VB.NET 程序中需要 CPU 的温度传感器,我想使用 OpenHardwareMonitorLib.dll 来获取 CPU 温度的值。
我从这里下载 dll:http: //openhardwaremonitor.org/downloads/
我只有这个代码:
Imports OpenHardwareMonitor
Imports OpenHardwareMonitor.Hardware
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim cp As New Computer()
cp.Open()
cp.HDDEnabled = True
cp.FanControllerEnabled = True
cp.RAMEnabled = True
cp.GPUEnabled = True
cp.MainboardEnabled = True
cp.CPUEnabled = True
Dim Info As String = ""
For i As Integer = 0 To cp.Hardware.Count() - 1
If cp.Hardware(i).HardwareType = HardwareType.Mainboard Then
Info += " Motherboard: " & Trim(cp.Hardware(i).Name) & vbCrLf
End If
If cp.Hardware(i).HardwareType = HardwareType.CPU Then
Info += " Processor: " & Trim(cp.Hardware(i).Name) & vbCrLf
End If
If cp.Hardware(i).HardwareType = HardwareType.GpuNvidia Then
Info += " Video Card: " & Trim(cp.Hardware(i).Name) & vbCrLf
End If
If cp.Hardware(i).HardwareType = HardwareType.RAM Then
Info += " RAM: " & Trim(cp.Hardware(i).Name) & vbCrLf
End If
If cp.Hardware(i).HardwareType = HardwareType.HDD Then
Info += " HDD: " & Trim(cp.Hardware(i).Name) & vbCrLf
End If
If cp.Hardware(i).HardwareType = HardwareType.SuperIO Then
Info += " SuperIO: " & Trim(cp.Hardware(i).Name) & vbCrLf
End If
Next
TextBox1.Text = Info
End Sub
End Class
但是有了这个我只得到我的硬件的名称我需要 CPU 温度。
我尝试在 VB.NET 中使用 WMI,但收到不支持的消息。