RT:
麻烦解释下 我看好多程序都要用这个 好像获取什么CPU 温度什么的··都是用这个 
然后 求详解教程 

解决方案 »

  1.   


    没用到过不知道你说的哪个api....r看看这个
      

  2.   

    取系统信息用 WMI 就可以了。API就是一些标准的操作系统调用而已。参考资料是 Windows Platform SDK。在微软网站可以下载。不过SDK文档是英文的,并且是面向C语言的。
      

  3.   

    API = Application Programming Interface
      

  4.   

    using System;
    using System.Collections.Generic;
    using System.Text;    /// <summary>
        /// Defines an abstract base class for implementations of CPU usage counters.
        /// </summary>
        public abstract class CpuUsage
        {
            /// <summary>
            /// Creates and returns a CpuUsage instance that can be used to query the CPU time on this operating system.
            /// </summary>
            /// <returns>An instance of the CpuUsage class.</returns>
            /// <exception cref="NotSupportedException">This platform is not supported -or- initialization of the CPUUsage object failed.</exception>
            public static CpuUsage Create()
            {
                if (m_CpuUsage == null)
                {
                    if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                        m_CpuUsage = new CpuUsageNt();
                    //else if (Environment.OSVersion.Platform == PlatformID.Win32Windows)
                    //    m_CpuUsage = new CpuUsage9x();
                    else
                        throw new NotSupportedException();
                }
                return m_CpuUsage;
            }
            /// <summary>
            /// Determines the current average CPU load.
            /// </summary>
            /// <returns>An integer that holds the CPU load percentage.</returns>
            /// <exception cref="NotSupportedException">One of the system calls fails. The CPU time can not be obtained.</exception>
            public abstract int Query();
            /// <summary>
            /// Holds an instance of the CPUUsage class.
            /// </summary>
            private static CpuUsage m_CpuUsage = null;
        }
      

  5.   

    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");}