typedef struct _SYSTEM_POWER_STATUS
{
BYTE ACLineStatus;
BYTE BatteryFlag;
BYTE BatteryLifePercent;
BYTE Reserved1;
DWORD BatteryLifeTime;
DWORD BatteryFullLifeTime;
} SYSTEM_POWER_STATUS,
*LPSYSTEM_POWER_STATUS;
SYSTEM_POWER_STATUS sysPower = {0};
GetSystemPowerStatus(&sysPower);
【注意】本API只能读取一块电池电量的信息,对应Windows设备多块电池信息的读取,则需要另外的代码来读取。