Windows follows the ACPI specification , and given the specification, gives a method of calculating the remaining battery life, I would suggest that it will be the way they do it.
Edit: Several confirmatory sources were found .
I am referring, in particular, to chapter 3.9.3 "Gas Battery Charge Sensor".
Remaining Battery Percentage[%] = Battery Remaining Capacity [mAh/mWh] / Last Full Charged Capacity [mAh/mWh]* 100
if you need it in hours:
Remaining Battery Life [h]= Battery Remaining Capacity [mAh/mWh] / Battery Present Drain Rate [mA/mW]
This essentially represents the current rate of change in charge capacity per unit time, you need to look at the ACPI specification to see how Windows implements it.
The variables that I would say should have been requested from the battery controller, and I would have allowed Windows to handle all compatibility issues. To do this, there is the Win32_Battery Windows Management Tool and (probably more appropriate) Win32_PortableBattery . After some further digging, it seems that these classes calculate the remaining time for you and do not expose the current battery charge (perhaps in order to encourage people to calculate only one problem / rounding, etc.). The closest cool thing you can do is evaluate / calculate battery drain at FullChargeCapacity / DesignCapacity . The next best thing I could find looks like a lower-level API, opened through IOCTL_BATTERY_QUERY_INFORMATION , but it also seems to not give the current charge capacity in millivolts. tl; dr Use the remaining times and percentages calculated for you by the above classes, if possible: /
Aside, some laptop manufacturers are linking their own tools to calculate the remaining time and request specific microcontroller implementations in their own batteries and can make a more informed / impersonal question about the remaining battery.
source share