问题描述
我对编程非常陌生,我正在尝试在 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 (将#修改为@)