如何解决使用openhardwaremonitor dll麻烦
我对编程非常陌生,我正在尝试在 Windows 的小树莓派面板上创建自定义屏幕监控。
为此,我正在使用 Visual Studio 2019,我希望在 vb.net 中对其进行编码(我知道一点)。
所以我尝试使用 openhardwaremonitor dll OpenHardwareMonitorLib.dll 访问系统传感器
我成功访问了一些传感器,但我不知道我真正访问的是什么,是否有一些关于图书馆的文档?我没有找到它。
这是我目前所在的位置:
''' 公开课表1
Public Sub Form1_Load(sender As Object,e As EventArgs) Handles MyBase.Load
End Sub
Public Sub Button1_Click(sender As Object,e As EventArgs) Handles Button1.Click
Timer1.Interval = 100
Timer1.Enabled = True
Timer1.Start()
End Sub
Private Sub Timer1_Tick(sender As Object,e As System.EventArgs) Handles Timer1.tick
Dim cputemperature1 As String
Dim cputemperature2 As String
Dim cputemperature3 As String
Dim cputemperature4 As String
Dim cputemperature5 As String
Dim cputemperature6 As String
Dim cputemperature7 As String
Dim cputemperature8 As String
Dim cputemperature9 As String
Dim computer As New Computer()
computer.open()
computer.cpuEnabled = True
computer.GPUEnabled = True
Dim cpu = computer.Hardware.Where(Function(h) h.HardwareType = HardwareType.cpu).FirstOrDefault()
If cpu IsNot nothing Then
cpu.Update()
End If
Dim tempSensors = cpu.Sensors.Where(Function(s) s.SensorType = SensorType.Temperature)
cputemperature1 = tempSensors.ToList.Item(0).Value
cputemperature2 = tempSensors.ToList.Item(1).Value
cputemperature3 = tempSensors.ToList.Item(2).Value
cputemperature4 = tempSensors.ToList.Item(3).Value
cputemperature5 = tempSensors.ToList.Item(4).Value
cputemperature6 = tempSensors.ToList.Item(5).Value
cputemperature7 = tempSensors.ToList.Item(6).Value
cputemperature8 = tempSensors.ToList.Item(7).Value
cputemperature9 = tempSensors.ToList.Item(8).Value
Label1.Text = cputemperature1
Label2.Text = cputemperature2
Label3.Text = cputemperature3
Label4.Text = cputemperature4
Label5.Text = cputemperature5
Label5.Text = cputemperature6
Label7.Text = cputemperature7
Label8.Text = cputemperature8
Label9.Text = cputemperature9
End Sub
结束类 '''
我使用我在网上找到的东西自己制作的。但我什至不确定“tempSensors.ToList.Item(8).Value”指的是哪些传感器。
感谢您的帮助
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。