Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[ The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]
Gets the remaining capacity of the computer battery as a percentage of total capacity.
This property is read-only.
Syntax
ibatteryPercentRemaining = System.Machine.PowerStatus.batteryPercentRemaining
Property value
An Integer that receives the percentage.
Remarks
The value of batteryPercentRemaining is an estimate only.
If the computer is plugged in with the battery connected and charging, batteryPercentRemaining will indicate that battery capacity is 100 percent.
Examples
The following example demonstrates how to get the power supply information for the computer.
// --------------------------------------------------------------------
// Get the machine power information.
// --------------------------------------------------------------------
function GetPowerStatus()
{
if (System.Machine.PowerStatus.isPowerLineConnected == false)
{
sMachinePowerInfo = "Power Supply: Battery<br/>";
sMachinePowerInfo += "Battery Capacity Remaining: " + System.Machine.batteryCapacityRemaining + "<br/>";
sMachinePowerInfo += "Battery Capacity Total: " + System.Machine.batteryCapacityTotal + "<br/>";
sMachinePowerInfo += "Battery Percent Remaining: " + System.Machine.batteryPercentRemaining + "<br/>";
sMachinePowerInfo += "Battery Status: " + System.Machine.batteryStatus + "<br/>";
sMachinePowerInfo += "Is Battery Charging: " + System.Machine.isBatteryCharging + "<br/>";
sMachinePowerInfo += "Available Memory: " + System.Machine.availableMemory + "<br/>";
}
else
{
sMachinePowerInfo += "Power Supply: Plugged in<br/>";
}
return sMachinePowerInfo;
}
Requirements
| Minimum supported client |
Windows Vista [desktop apps only] |
| Minimum supported server |
Windows Server 2008 [desktop apps only] |
| End of client support |
Windows 7 |
| End of server support |
Windows Server 2008 |
| IDL |
|
| DLL |
|