这是一个Windows下的硬件扫描和测试工具
ht---tps://---github.c---om/BurnellLiu/BLHWScaner
将CoreTemp目录cp到项目目录下,
将WinRing0/release 目录下所有文件cp到你项目输出目录,
这个是参照CoreTempTester下main.cpp写的
#include "stdafx.h"
#include <stdlib.h>
#include <iostream>
#include "CoreTemp/LCpuTemp.h"
//#include "CoreTemp/LGpuTemp.h"
#include "CoreTemp\DebugPrint.h"
//#include "define.h"
/// @brief 最大处理器物理核心数
#ifndef MAX_PROCESSOR_PHYSICAL_CORE_NUM
#define MAX_PROCESSOR_PHYSICAL_CORE_NUM 64
#endif
/// @brief 最大GPU温度传感器数量
#ifndef MAX_GPU_SENSORS_NUMBER
#define MAX_GPU_SENSORS_NUMBER 16
#endif
int GetCoreTemp()
{
bool bRet = false;
unsigned int cpuCoreNum = 0;
unsigned int gpuCoreNum = 0;
unsigned int cpuTemp[MAX_PROCESSOR_PHYSICAL_CORE_NUM] = { 0 };
unsigned int gpuTemp[MAX_GPU_SENSORS_NUMBER] = { 0 };
wstring winRing0Path = L"WinRing0.dll";
LCpuTemp * gCpuTemp = new LCpuTemp(winRing0Path);
bRet = gCpuTemp->Get(cpuCoreNum, cpuTemp);
unsigned int averTemp = 0; //平均值
if (!bRet)
{
DebugPrint("GetCpuTemp Fail\n");
}
else
{
DebugPrint("Cpu Core Num Is: %u\n", cpuCoreNum);
for (unsigned int i = 0; i < cpuCoreNum; i++)
{
DebugPrint("Cpu Core(%u) Temp Is: %u\n", i, cpuTemp[i]);
averTemp += cpuTemp[i];
}
}
return averTemp/2;
}
nvapi.lib 静态链接库总是提示错误 :连接错误
LGpuTemp.cpp文件下修改
#pragma comment(lib, "nvapi.lib")
//#pragma comment(lib, ".\\nvapi\\nvapi.lib")
在解决方案右键添加现有项 添加nvapi.lib
结果:
使用OpenHardwarMonitor 的结果为: