Reputation: 141
I want to get the battery temperature in Windows, and I have tried DeviceIoControl function (http://msdn.microsoft.com/en-us/library/aa372698(v=vs.85).aspx) on the BatteryTemperature.
I have tried other parameter like BatterySerialNumber, and it returns the serial number, but while I want to get the temperature, the function returns FALSE. And GetLastError returns S_FALSE.
My enviroment is Win7 Enterprise SP1, I developed on VS2008+SP1, total C++ code, my laptop is HP Elitebook 2570p. Can anyone give some suggestions on this topic. I have searched Google and donot find any help topic, or should I write some driver code to get the temperature? Or this laptop battery doesnot support this function?
Thanks very much.
PS. If there are any other tech which can get the temperature is welcome, not only in C++.
Upvotes: 5
Views: 18381
Reputation: 681
S_FALSE returned by GetLastError is also just 1, which is also ERROR_INVALID_FUNCTION. Extract from MSDN:
If the particular type of data requested is not available for the current battery, then ERROR_INVALID_FUNCTION is returned.
This means your battery has no temperature sensor or manufacturer who written the battery driver decided not to provide this information to Windows.
Upvotes: 1
Reputation: 253
You can check the temperature of the system board and processor with a utility program. As far as checking the temperature of the battery goes..I suggest an infrared thermometer. (most people don't have access to such specialized equipment). I suggest using a notebook cooling pad.
You could also use a program called "speed fan" which you can control the speed of your computers fans but i'm not sure if it will cool your battery much...
if you want to try out "speed fan" here is the link:http://www.almico.com/sfdownload.php
Upvotes: 0