GetSystemPowerStatusEx
This function retrieves the power status of the system. The status indicates whether the system is running on AC or DC power, whether or not the batteries are currently charging, and the remaining life of main and backup batteries.
BOOL GetSystemPowerStatusEx(
PSYSTEM_POWER_STATUS_EX pstatus,
BOOL fUpdate );
Parameters
pstatus
[out] Pointer to the SYSTEM_POWER_STATUS_EX structure receiving the power status information.
fUpdate
[in] If this Boolean is set to TRUE, GetSystemPowerStatusEx gets the latest information from the device driver, otherwise it retrieves cached information that may be out-of-date by several seconds.
Return Values
This function returns TRUE if successful; otherwise, it returns FALSE.
Remarks
The GetSystemPowerStatusEx function is not supported for emulation.
Requirements
Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winbase.h
Pocket PC 2002 Windows CE OS 3.0 Winbase.h Winbase.h coredll.lib
Pocket PC Windows CE OS 3.0 Winbase.h Header Link to
Note This information applies to the version of the operating system as provided by Microsoft. Actual implementation is determined by the original equipment manufacturer (OEM) and some devices may not support this function.
SYSTEM_POWER_STATUS_EX
This structure contains information about the power status of the system.
typedef struct _SYSTEM_POWER_STATUS_EX {
BYTE ACLineStatus;
BYTE BatteryFlag;
BYTE BatteryLifePercent;
BYTE Reserved1;
DWORD BatteryLifeTime;
DWORD BatteryFullLifeTime;
BYTE Reserved2;
BYTE BackupBatteryFlag;
BYTE BackupBatteryLifePercent;
BYTE Reserved3;
DWORD BackupBatteryLifeTime;
DWORD BackupBatteryFullLifeTime;
} SYSTEM_POWER_STATUS_EX, *PSYSTEM_POWER_STATUS_EX, *LPSYSTEM_POWER_STATUS_EX;
Members
ACLineStatus
AC power status. It is one of the following values: Value Description
0 Offline
1 Online
255 Unknown status
All other values are reserved.
BatteryFlag
Battery charge status. It can be a combination of the following values: Value Description
1 High
2 Low
4 Critical
8 Charging
128 No system battery
255 Unknown status
All other values are reserved.
BatteryLifePercent
Percentage of full battery charge remaining. This member can be a value in the range 0 to 100, or 255 if status is unknown. All other values are reserved.
Reserved1
Reserved; set to zero.
BatteryLifeTime
Number of seconds of battery life remaining, or 0xFFFFFFFF if remaining seconds are unknown.
BatteryFullLifeTime
Number of seconds of battery life when at full charge, or 0xFFFFFFFF if full lifetime is unknown.
Reserved2
Reserved; set to zero.
BackupBatteryFlag
Backup battery charge status. It is one of the following values: BATTERY_FLAG_HIGH
BATTERY_FLAG_CRITICAL
BATTERY_FLAG_CHARGING
BATTERY_FLAG_NO_BATTERY
BATTERY_FLAG_UNKNOWN
BATTERY_FLAG_LOW
BackupBatteryLifePercent
Percentage of full backup battery charge remaining. Must be in the range 0 to 100, or BATTERY_PERCENTAGE_UNKNOWN.
Reserved3
Reserved; set to zero
BackupBatteryLifeTime
Number of seconds of backup battery life remaining, or BATTERY_LIFE_UNKNOWN if remaining seconds are unknown.
BackupBatteryFullLifeTime
Number of seconds of backup battery life when at full charge, or BATTERY_LIFE_UNKNOWN if full lifetime is unknown.