如何获取cpu温度
来源:百度知道 编辑:UC知道 时间:2024/05/26 06:46:06
有人说用winIo的如下代码
bool bResult = InitializeWinIo();
DWORD dwPortVal;
if (bResult)
{
GetPortVal(端口地址, &dwPortVal, 4);
ShutdownWinIo();
}
可我又不知道cpu温度的端口地址是多少.
有谁知道怎么获取呀,不要讲的不清不楚的,不要网上搜来的,网上的我基本都看过了.
我是要自己写程序,不要推荐现有的软件给我,除非有源码
都是乱回答一通
提取的某ocx部分 调用 getcpu() 返回值就是温度了
long getcpu()
{
// TODO: Add your dispatch handler code here
SYSTEM_PERFORMANCE_INFORMATION SysPerfInfo;
SYSTEM_TIME_INFORMATION SysTimeInfo;
SYSTEM_BASIC_INFORMATION SysBaseInfo;
double dbIdleTime;
double dbSystemTime;
LONG status;
LARGE_INTEGER liOldIdleTime = {0,0};
LARGE_INTEGER liOldSystemTime = {0,0};
NtQuerySystemInformation = (PROCNTQSI)GetProcAddress(
GetModuleHandle("ntdll"),
"NtQuerySystemInformation"
);
if (!NtQuerySystemInformation)
return 0;
// get number of processors in the system
status = NtQuerySystem