I want to know how to add CPU temperature in C# windows form
How can i add CPU temperature in C#
- 1.3K 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
-
a2digitalsolution 20
-
syamantacvillkodai 3
-
sathyaonline 3
-
RobertCromb 2
-
WSJustin 2
-
gxzzzfnykcw 2
-
wuzyjttoir 2
-
Svetlanaxhu 2
-
VictorThorm 2
-
robinqs2 2