开发者

How would I be able to know if the battery is still charging or full in Windows CE 6?

开发者 https://www.devze.com 2023-02-15 19:39 出处:网络
When charging, how will I know if the battery is already full? GetSystemPowerStatusE开发者_开发问答x2() only tells if it is charging.

When charging, how will I know if the battery is already full?

GetSystemPowerStatusE开发者_开发问答x2() only tells if it is charging.


  • How to: Determine Battery Status

The Windows CE GetSystemPowerStatusEx2 function can be called to return the SYSTEM_POWER_STATUS_EX2 structure. This structure contains important details about the power state of the device. Three of the most useful details in this structure are the ACLineStatus, BatteryFlag, and BatteryLifePercent members.

To produce accurate and complete information, device manufacturers must populate this data from their battery drivers, as shown in the following code:

PSYSTEM_POWER_STATUS_EX2 pwrstat=0;
if (!GetSystemPowerStatusEx2(pwrstat,sizeof(pwrstat),FALSE))
{
    MessageBox(hWnd,_T("Couldn't get power state"), _T("Error"),MB_OK);
} 
else
{
    // Extract the power status information you need.
}
0

精彩评论

暂无评论...
验证码 换一张
取 消