如何用c# 获取cpu温度!

2025-01-05 08:52:24
推荐回答(2个)
回答(1):

ManagementObjectSearcher vManagementObjectSearcher = new ManagementObjectSearcher(@"root\WMI", @"select * from MSAcpi_ThermalZoneTemperature");
foreach (ManagementObject vManagementObject in
vManagementObjectSearcher.Get())
{ //-2732再除以10
double temperature = double.Parse(vManagementObject.Properties["CurrentTemperature"].Value.ToString());
temperature = (temperature - 2732) / 10;
this.richTextBox1.Text=(temperature.ToString());
}

回答(2):

System.Diagnostics
这个命名空间下面有相应的类库