Dim power As PowerStatus = SystemInformation.PowerStatus
Dim percent As Single = power.BatteryLifePercent
or
PowerStatus power = SystemInformation.PowerStatus;
float percent = power.BatteryLifePercent;
(I would prefer a vb answer as that is what the application is written in but can convert so c# is fine if you dont know vb)
I understand that the above will give me the battery percentage remaining - BUT I have a tablet that is 'hot swappable' (it has a main battery then a small 5 minute battery that runs the tablet while you swap batteries on it) - how would I find the status of the second battery?
I am looking for something like SystemInformation.PowerStatus(0)
but I have NO idea what I am actually trying to find and I must be having a Google block as I cannot find anything.
You can use WMI and Win32 to get the battery levels.
Try this:
ObjectQuery query = new ObjectQuery("Select * FROM Win32_Battery");
foreach (ManagementObject o in new ManagementObjectSearcher(query).Get())
{
uint level = (uint)o.Properties["EstimatedChargeRemaining"].Value;
}