Hello,
Welcome to Microsoft Q&A!
You could try to use GetSystemPowerStatus function to retrieve the current power status of the computer. In particular, the application should check the BatteryFlag, BatteryLifeTime, and BatteryLifePercent members of the SYSTEM_POWER_STATUS structure
for any changes. PBT_APMPOWERSTATUSCHANGE eventcan occur when battery life drops to less than 5 minutes, or when the percentage of battery life drops below 10 percent, or if the battery life changes by 3 percent.
For more details you could refer to the Doc: System Power Status Events
Thank you.
Jeanine
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.