BATTERY_STATUS structure
Contains the current state of the battery. This structure is used by the IOCTL_BATTERY_QUERY_STATUS control code.
Syntax
typedef struct _BATTERY_STATUS {
ULONG PowerState;
ULONG Capacity;
ULONG Voltage;
LONG Rate;
} BATTERY_STATUS, *PBATTERY_STATUS;
Members
-
PowerState
-
The battery state. This member can be zero, one, or more of the following values.
Value Meaning - BATTERY_CHARGING
- 0x00000004
Indicates that the battery is currently charging. - BATTERY_CRITICAL
- 0x00000008
Indicates that battery failure is imminent. See the Remarks section for more information. - BATTERY_DISCHARGING
- 0x00000002
Indicates that the battery is currently discharging. - BATTERY_POWER_ON_LINE
- 0x00000001
Indicates that the system has access to AC power, so no batteries are being discharged. -
Capacity
-
The current battery capacity, in mWh (or relative). This value can be used to generate a "gas gauge" display by dividing it by FullChargedCapacity member of the BATTERY_INFORMATION structure. If the capacity is unavailable, this member is BATTERY_UNKNOWN_CAPACITY.
-
Voltage
-
The current battery voltage across the battery terminals, in millivolts (mv). If the voltage is unavailable, this member is BATTERY_UNKNOWN_VOLTAGE.
-
Rate
-
The current rate of battery charge or discharge. This value will be in milliwatts unless the battery rate information is relative, in which case it will be in arbitrary units per hour. To determine if battery information is relative, examine the BATTERY_CAPACITY_RELATIVE flag in the Capabilities member of the BATTERY_INFORMATION structure. A nonzero, positive rate indicates charging; a negative rate indicates discharging. Some batteries report only discharging rates. If the rate is unavailable, this member is BATTERY_UNKNOWN_RATE. If the state of the battery or power source changes, the rate may become available.
Remarks
The BATTERY_CRITICAL flag in the PowerState member of this structure indicates a hardware "battery critical" condition. This critical level is set by the battery manufacturer, not by the user in the "critical battery alarm." It generally means that the battery system has calculated that the battery is totally drained, and any power being drawn is beyond what is expected.
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows XP [desktop apps only] |
Minimum supported server |
Windows Server 2003 [desktop apps only] |
Header |
|