The CPU temperature

Good time of day. I appeal to you with this question, does Visual Studio 2010 have any tools to determine CPU temperature?
October 8th 19 at 02:29
3 answers
October 8th 19 at 02:31
Is PDH. Wait, I was somewhere in the code...
#pragma comment(lib, "C:\\Program Files\Microsoft SDKs\\Windows\\v6.0A\\Lib\\Pdh.Lib")

int main() {

int load = 0;

HQUERY hQuery;
HCOUNTER hCounter;
PdhOpenQuery(NULL, 0, &hQuery);
PdhAddCounter(hQuery, TEXT("\\Processor(_Total)\\% Processor Time"), 0, &hCounter);



PdhGetFormattedCounterValue(hCounter, PDH_FMT_DOUBLE, NULL, &fmtValue);
load = (int)fmtValue.doubleValue;


return load;

- Sim_Volkm commented on October 8th 19 at 02:34
So this is a download (counter % Processor Time), but not temperature - Zakary74 commented on October 8th 19 at 02:37
When calling PdhCollectQueryData() the first time it is given the wrong value. If you call this function again with a delay, given the actual load. Most likely, this feature measures the average of the counter value between calls.

Names of counters, transmitted in PdhAddCounter() (for page file, for example) can be viewed in the snap-in Performance. - Sim_Volkm commented on October 8th 19 at 02:40
Yes, exactly. It's the CPU, not the temperature. C it I have failed. Tried through WMI I got there in the facility was inadequate value, so scored. - Sim_Volkm commented on October 8th 19 at 02:43
October 8th 19 at 02:33
Can see how it is implemented in the Aspia (open the program collects all the information about the hardware, here, on habré there were a couple of posts about it).
Look, thanks) - Sim_Volkm commented on October 8th 19 at 02:36
October 8th 19 at 02:35
Still it is possible through WMI. Code lig Google like "get cpu temperature WMI"
Thank you for the information) - Sim_Volkm commented on October 8th 19 at 02:38

Find more questions by tags Cooling systemsVisual Studio