
如何获取cpu温度 100
我要写一个实时显示CPU温度的软件,查了很多国内外的网站,就是查不到要怎么获取.有人说用winIo的如下代码boolbResult=InitializeWinIo();D...
我要写一个实时显示CPU温度的软件,查了很多国内外的网站,就是查不到要怎么获取.
有人说用winIo的如下代码
bool bResult = InitializeWinIo();
DWORD dwPortVal;
if (bResult)
{
GetPortVal(端口地址, &dwPortVal, 4);
ShutdownWinIo();
}
可我又不知道cpu温度的端口地址是多少.
有谁知道怎么获取呀,不要讲的不清不楚的,不要网上搜来的,网上的我基本都看过了.
我是要自己写程序,不要推荐现有的软件给我,除非有源码
都是乱回答一通 展开
有人说用winIo的如下代码
bool bResult = InitializeWinIo();
DWORD dwPortVal;
if (bResult)
{
GetPortVal(端口地址, &dwPortVal, 4);
ShutdownWinIo();
}
可我又不知道cpu温度的端口地址是多少.
有谁知道怎么获取呀,不要讲的不清不楚的,不要网上搜来的,网上的我基本都看过了.
我是要自己写程序,不要推荐现有的软件给我,除非有源码
都是乱回答一通 展开
10个回答
展开全部
提取的某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 = NtQuerySystemInformation(SystemBasicInformation,&SysBaseInfo,sizeof(SysBaseInfo),NULL);
if (status != NO_ERROR)
return 0;
printf("\nCPU Usage (press any key to exit): ");
while(!_kbhit())
{
// get new system time
status = NtQuerySystemInformation(SystemTimeInformation,&SysTimeInfo,sizeof(SysTimeInfo),0);
if (status!=NO_ERROR)
return 0;
// get new CPU's idle time
status = NtQuerySystemInformation(SystemPerformanceInformation,&SysPerfInfo,sizeof(SysPerfInfo),NULL);
if (status != NO_ERROR)
return 0;
// if it's a first call - skip it
if (liOldIdleTime.QuadPart != 0)
{
// CurrentValue = NewValue - OldValue
dbIdleTime = Li2Double(SysPerfInfo.liIdleTime) - Li2Double(liOldIdleTime);
dbSystemTime = Li2Double(SysTimeInfo.liKeSystemTime) - Li2Double(liOldSystemTime);
// CurrentCpuIdle = IdleTime / SystemTime
dbIdleTime = dbIdleTime / dbSystemTime;
// CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors
dbIdleTime = 100.0 - dbIdleTime * 100.0 / (double)SysBaseInfo.bKeNumberProcessors + 0.5;
printf("\b\b\b\b%3d%%",(UINT)dbIdleTime);
return (long)(UINT)dbIdleTime;
}
// store new CPU's idle and system time
liOldIdleTime = SysPerfInfo.liIdleTime;
liOldSystemTime = SysTimeInfo.liKeSystemTime;
// wait one second
Sleep(1000);
}
printf("\n");
return 0;
}
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 = NtQuerySystemInformation(SystemBasicInformation,&SysBaseInfo,sizeof(SysBaseInfo),NULL);
if (status != NO_ERROR)
return 0;
printf("\nCPU Usage (press any key to exit): ");
while(!_kbhit())
{
// get new system time
status = NtQuerySystemInformation(SystemTimeInformation,&SysTimeInfo,sizeof(SysTimeInfo),0);
if (status!=NO_ERROR)
return 0;
// get new CPU's idle time
status = NtQuerySystemInformation(SystemPerformanceInformation,&SysPerfInfo,sizeof(SysPerfInfo),NULL);
if (status != NO_ERROR)
return 0;
// if it's a first call - skip it
if (liOldIdleTime.QuadPart != 0)
{
// CurrentValue = NewValue - OldValue
dbIdleTime = Li2Double(SysPerfInfo.liIdleTime) - Li2Double(liOldIdleTime);
dbSystemTime = Li2Double(SysTimeInfo.liKeSystemTime) - Li2Double(liOldSystemTime);
// CurrentCpuIdle = IdleTime / SystemTime
dbIdleTime = dbIdleTime / dbSystemTime;
// CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors
dbIdleTime = 100.0 - dbIdleTime * 100.0 / (double)SysBaseInfo.bKeNumberProcessors + 0.5;
printf("\b\b\b\b%3d%%",(UINT)dbIdleTime);
return (long)(UINT)dbIdleTime;
}
// store new CPU's idle and system time
liOldIdleTime = SysPerfInfo.liIdleTime;
liOldSystemTime = SysTimeInfo.liKeSystemTime;
// wait one second
Sleep(1000);
}
printf("\n");
return 0;
}
展开全部
网上有许多检测CPU温度的软件如CpuIdle
Extreme,还可以下载个超级兔子来检测,简单易用,还能随时监控。
Extreme,还可以下载个超级兔子来检测,简单易用,还能随时监控。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以下载一个优化大师
都可以看到的
包括
CPU
温度
风扇转速
硬盘温度
主板温度
都可以看到的
包括
CPU
温度
风扇转速
硬盘温度
主板温度
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
目前用的最多的,就是这款叫做EVEREST的软件。看不懂英文的最好下载个汉化的,
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用EVEREST就可以查到包括显卡 主板等温度
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询