在mfc中怎么获取cpu温度?

ml2525 2010-06-23 01:17:21
在mfc中怎么获取cpu温度?
...全文
618 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
ml2525 2010-06-24
  • 打赏
  • 举报
回复
strComputer = "."
Set colTempProbe = GetObject("Winmgmts:"_
& "{impersonationLevel=impersonate}!\\"_
& strComputer & "\root\cimv2")._
InstancesOf("Win32_TemperatureProbe")
Num = 0
For Each obj In colTempProbe
WScript.Echo obj.Name & VBNewLine _
& obj.DeviceID & VBNewLine _
& obj.Status & VBNewLine _
& obj.Resolution & VBNewLine _
& obj.Tolerance & VBNewLine _
& obj.Accuracy
Num = Num +1
Next
If Num = 0 Then
WScript.Echo "No temperature probe data"
End If

能帮我把这段代码翻译成 vc6.0吗?谢谢
[Quote=引用 9 楼 cliffbaby 的回复:]
可以用!
[/Quote]
cliffbaby 2010-06-23
  • 打赏
  • 举报
回复
可以用!
ml2525 2010-06-23
  • 打赏
  • 举报
回复
对了我这个是vc6.0,这个函数也能用吗?
ml2525 2010-06-23
  • 打赏
  • 举报
回复
非常感谢,不过我们公司只能上csdn,别的网站上不去,我晚上回家再看吧,非常感谢!
lvshaoqing 2010-06-23
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 ml2525 的回复:]
api 函数我用过,可是没有用过类呀,高手能简单些几行代码吗?类里面那么多成员哪个是温度丫?还有我的电脑是双核的,也可以用这个函数获取吗?
[/Quote]

http://www.scriptinternals.de/new/us/Support/Internal/WMI_Win32_TemperatureProbe.htm
ml2525 2010-06-23
  • 打赏
  • 举报
回复
api 函数我用过,可是没有用过类呀,高手能简单些几行代码吗?类里面那么多成员哪个是温度丫?还有我的电脑是双核的,也可以用这个函数获取吗?
lvshaoqing 2010-06-23
  • 打赏
  • 举报
回复
需要动态库:Cimwin32.dll.
lvshaoqing 2010-06-23
  • 打赏
  • 举报
回复
The Win32_TemperatureProbe WMI class represents the properties of a temperature sensor (electronic thermometer).

Most of the information that the Win32_TemperatureProbe WMI class provides comes from SMBIOS. Real-time readings for the CurrentReading property cannot be extracted from SMBIOS tables. For this reason, current implementations of WMI do not populate the CurrentReading property. The CurrentReading property's presence is reserved for future use.

The following syntax is simplified from Managed Object Format (MOF) code and includes all inherited properties.


class Win32_TemperatureProbe : CIM_TemperatureSensor
{
sint32 Accuracy;
uint16 Availability;
string Caption;
uint32 ConfigManagerErrorCode;
boolean ConfigManagerUserConfig;
string CreationClassName;
sint32 CurrentReading;
string Description;
string DeviceID;
boolean ErrorCleared;
string ErrorDescription;
datetime InstallDate;
boolean IsLinear;
uint32 LastErrorCode;
sint32 LowerThresholdCritical;
sint32 LowerThresholdFatal;
sint32 LowerThresholdNonCritical;
sint32 MaxReadable;
sint32 MinReadable;
string Name;
sint32 NominalReading;
sint32 NormalMax;
sint32 NormalMin;
string PNPDeviceID;
uint16 PowerManagementCapabilities[];
boolean PowerManagementSupported;
uint32 Resolution;
string Status;
uint16 StatusInfo;
string SystemCreationClassName;
string SystemName;
sint32 Tolerance;
sint32 UpperThresholdCritical;
sint32 UpperThresholdFatal;
sint32 UpperThresholdNonCritical;
};

ml2525 2010-06-23
  • 打赏
  • 举报
回复
你好,能具体说一下吗?我刚学这个不太会。谢谢!
lvshaoqing 2010-06-23
  • 打赏
  • 举报
回复
Win32_TemperatureProbe, 在SDK的Windows Management Instrumentation

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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