|
SYSTEM_POWER_STATUS_EX spse;
GetSystemPowerStatusEx(&spse, TRUE);
SYSTEM_POWER_STATUS_EX的定义是这样的:
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;
如果获取成功的话,就可以直接访问结构体当中的成员.比如,我们要看电池的可用百分比.访问spse.BackupBatteryLifePercent;它的值是0-100.
同理可推,你就可以开发实现你的想法了. |
|