首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

c#怎么获得cpu温度

2012-06-14 
c#如何获得cpu温度大家好,RT。有没有哪个函数能获取cpu温度?cpu使用率呢?谢谢![解决办法]C# codeusing Syst

c#如何获得cpu温度
大家好,RT。
有没有哪个函数能获取cpu温度?
cpu使用率呢?
谢谢!

[解决办法]

C# code
using System;using System.Diagnostics;class Program{    static void Main(string[] args)    {        PerformanceCounter[] counters = new PerformanceCounter[ System.Environment.ProcessorCount ];        for(int i=0; i<counters.Length; i++)        {            counters[i] = new PerformanceCounter("Processor", "% Processor Time", i.ToString());        }        while(true)        {            for(int i=0; i<counters.Length; i++)            {                float f = counters[i].NextValue();                Console.WriteLine("CPU-{0}: {1:f}%", i, f);            }            Console.WriteLine();            System.Threading.Thread.Sleep(1000);        }    }}
[解决办法]
C# code
Double CPUtprt = 0;System.Management.ManagementObjectSearcher mos = new System.Management.ManagementObjectSearcher(@"root\WMI", "Select * From MSAcpi_ThermalZoneTemperature");foreach (System.Management.ManagementObject mo in mos.Get()){     CPUtprt = Convert.ToDouble(Convert.ToDouble(mo.GetPropertyValue("CurrentTemperature").ToString()) - 2732) / 10;textBox1.Text = ("CPU 溫度 : " + CPUtprt.ToString() + " °C");}
[解决办法]
探讨
C# code
Double CPUtprt = 0;

System.Management.ManagementObjectSearcher mos = new System.Management.ManagementObjectSearcher(@"root\WMI", "Select * From MSAcpi_ThermalZoneTemperature");

foreach ……

[解决办法]
CPU温度也能这样知道,呵呵,学习了
[解决办法]
http://topic.csdn.net/u/20081205/16/c7885a51-6e8b-4e16-9ee5-914c6e690349.html
[解决办法]
引用System.Management

加入如下代码:
Double CPUtprt = 0;
System.Management.ManagementObjectSearcher mos = new System.Management.ManagementObjectSearcher(@"root\WMI", "Select * From MSAcpi_ThermalZoneTemperature");
foreach (System.Management.ManagementObject mo in mos.Get())
{
CPUtprt = Convert.ToDouble(Convert.ToDouble(mo.GetPropertyValue("CurrentTemperature").ToString()) - 2732) / 10;
this.textBox1 .Text = ("CPU 溫度 : " + CPUtprt.ToString() + " °C");
}
[解决办法]

[解决办法]
这个需要主板的接口吧,应该是主板的功能。
[解决办法]
多搜搜总能知道点什么,没有验证
http://zhidao.baidu.com/question/66112476.html
http://zhidao.baidu.com/question/53965579.html
http://it.sohu.com/52/57/article16715752.shtml
[解决办法]
CPU温度也能这样知道,呵呵,学习了

热点排行