CallNtPowerInformation results on .NET and XP?

  • Thread starter Thread starter Dominik Roettsches
  • Start date Start date
D

Dominik Roettsches

Hi,

we try to read SYSTEM_BATTERY_STATE from calling the platform SDK
function "CallNtPowerInformation" with POWER_INFORMATION_LEVEL code 0x5
(which should be the index for system battery state).

Provided that our marshalling code is correct, which it should be at
least for the leading booleans of the result, we get strange results.

When battery chord is attached to the notebook the result states the
opposite, the flags in general do not change (charging, discharging,
battery present...).

Has anyone tried using this function under XP, or has anyone *ever* got
useful results using this function?

We already tried to use GetSystemPowerStatus to get battery load
percentage but we wanted to have more accurate values from
"RemainingCapacity" which is in the SYSTEM_BATTERY_STATE struct.

Does anyone know how Windows calculates the remaining battery percentage?
How can you get a more accurate value than the integer percentage...?

Thanks for your help in advance,

Dominik
 
Back
Top