获取电脑电池电量信息的函数。。


BOOL WINAPI GetSystemPowerStatus(
  __out         LPSYSTEM_POWER_STATUS lpSystemPowerStatus
);


typedef struct _SYSTEM_POWER_STATUS {  BYTE ACLineStatus;  BYTE BatteryFlag;  BYTE BatteryLifePercent;  BYTE Reserved1;  DWORD BatteryLifeTime;  DWORD BatteryFullLifeTime;
} SYSTEM_POWER_STATUS,  *LPSYSTEM_POWER_STATUS;

Members
ACLineStatus 
The AC power status. This member can be one of the following values. 

Value Meaning 
0
 Offline
 
1
 Online
 
255
 Unknown status
 

BatteryFlag 
The battery charge status. This member can contain one or more of the following flags. 

Value Meaning 
1
 High—the battery capacity is at more than 66 percent
 
2
 Low—the battery capacity is at less than 33 percent
 
4
 Critical—the battery capacity is at less than five percent
 
8
 Charging
 
128
 No system battery
 
255
 Unknown status—unable to read the battery flag information
 

The value is zero if the battery is not being charged and the battery capacity is between low and high.

BatteryLifePercent 
The percentage of full battery charge remaining. This member can be a value in the range 0 to 100, or 255 if status is unknown.

Reserved1 
Reserved; must be zero.

BatteryLifeTime 
The number of seconds of battery life remaining, or –1 if remaining seconds are unknown.

BatteryFullLifeTime 
The number of seconds of battery life when at full charge, or –1 if full battery lifetime is unknown.


SYSTEM_POWER_STATUS sysPower = {0};


GetSystemPowerStatus(&sysPower);




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值