user472507
user472507

Reputation: 75

Read the current battery charge/discharge rate on a laptop

I've wrote a small piece of code that reads the current battery charge/discharge on my laptop. I followed the example code on this MSDN page.

My program updates the information every 100ms (by calling the DeviceIoControl function with IOCTL_BATTERY_QUERY_STATUS as control code) but the read value changes only after 5-10 seconds. For example if I change the screen brightness from the minimum value to the maximum the rate is updated only 5-10 seconds later. I've used Visual C++ 2010 on Windows 7 32-bit.

Does anybody knows how to get a real-time reading of the charge/discharge rate?

Upvotes: 4

Views: 3107

Answers (1)

Petrus Theron
Petrus Theron

Reputation: 28836

Depending on the accuracy of the sensor, it is likely that the status is only updated by the power device driver every 5-10 seconds or when significant changes take place.

Upvotes: 4

Related Questions