I want to know how to add CPU temperature in C# windows form
How can i add CPU temperature in C#
- 1.2K Views
- Last Post 19 March 2019
Mario Bojarovski posted this 23 February 2019
java2s posted this 11 March 2019
You can use WMI class to get cpu temperature
First, add a reference to System.Management.dll
To get cpu temperature you can use the query following
double temperature = 0;
string instanceName = "";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"root\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature");
foreach (ManagementObject obj in searcher.Get())
{
temperature = Convert.ToDouble(obj["CurrentTemperature"].ToString());
// Convert your value to celsius degrees
temperature = (temperature - 2732) / 10.0;
instanceName = obj["InstanceName"].ToString();
}
Console.WriteLine(temperature);
Console.WriteLine(instanceName);
and don't forget add using to System.Management.
Mario Bojarovski posted this 19 March 2019
Thanks so much, i have i more question : i want to know how can i add CPU temperature in c# windows form. Maybe answer is same but i work alone and nobody can't help me.
Thanks in advance.
Search
Categories
This Weeks High Earners
-
Williambip 2
-
KarinaKl 2
-
LuciusIF 2
-
TommyVog 2
-
SCVincent 2
-
DerrickFotte 2
-
Rolandvug 2
-
lvvwyeejolr 2
-
Sergicu 2
-
DonaldNib 2