C# api

回眸婉约 2011-06-01 10:52:30
RT:
麻烦解释下 我看好多程序都要用这个 好像获取什么CPU 温度什么的··都是用这个
然后 求详解教程
...全文
79 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
子夜__ 2011-06-01
  • 打赏
  • 举报
回复
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");

}
ycproc 2011-06-01
  • 打赏
  • 举报
回复


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


x8bits 2011-06-01
  • 打赏
  • 举报
回复
API = Application Programming Interface
threenewbee 2011-06-01
  • 打赏
  • 举报
回复
取系统信息用 WMI 就可以了。

API就是一些标准的操作系统调用而已。参考资料是 Windows Platform SDK。在微软网站可以下载。

不过SDK文档是英文的,并且是面向C语言的。
[14本经典Android开发教程] 2 Android开发手册 API函数详解 一 TextView的API 1 1 结构 java lang Object android view View android widget TextView 直接子类: Button CheckedTextView Chronometer DigitalClock EditText 间接子类: AutoCompleteTextView CheckBox CompoundButton ExtractEditText MultiAutoCompleteTextView RadioButton ToggleB utton 已上传1本: [14本经典Android开发教程] 1 Android开发从入门到精通 稍后上传剩余12本 http: download csdn net detail cleopard 8355245 @更多@ http: cleopard download csdn net 福利 http: xuemeilaile com @更多@ http: download csdn net user cleopard album 17份软件测试文档 http: download csdn net album detail 1425 13份WPF经典开发教程 http: download csdn net album detail 1115 C#资料合辑二[C#桌面编程入门篇] http: download csdn net album detail 957 C#资料合辑一[C#入门篇] http: download csdn net album detail 669 [Csharp高级编程 第6版 ] 共8压缩卷 http: download csdn net album detail 667 10个[精品资源]Java学习资料合辑[一] http: download csdn net album detail 663 10个C#Socket编程代码示例 http: download csdn net album detail 631 6份GDI+程序设计资源整合[全零分] http: download csdn net album detail 625 2014年移动游戏行业数据分析 http: download csdn net detail cleopard 8340331 一文读懂2014年全球互联网广告新生态 http: download csdn net detail cleopard 8340303">[14本经典Android开发教程] 2 Android开发手册 API函数详解 一 TextView的API 1 1 结构 java lang Object android view View android widget TextView 直接子类: Button CheckedTextView Chronometer DigitalClock EditText 间接子类: AutoCompleteTextView CheckBox CompoundBu [更多]

111,097

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧