[DllImport("coredll.dll")]
static extern bool GetSystemPowerStatusEx(out SYSTEM_POWER_STATUS_EX pStatus,
bool fUpdate);
Declare Function GetSystemPowerStatusEx Lib "coredll.dll" _
(<Out()> ByRef pStatus As SYSTEM_POWER_STATUS_EX, _
ByVal fUpdate As Boolean) As Boolean
Returns true if the function succeeds.
If fUpdate is true, the values will be read directly from the low level driver. If false, they may be cached values and may be several seconds old.
Please add some!
public static byte GetBatteryLeftPercentage()
{
SYSTEM_POWER_STATUS_EX powerStatus;
if (GetSystemPowerStatusEx(powerStatus, true))
return powerStatus.BackupBatteryLifePercent;
else
return 100; // assume full power if failed
}
TODO