Hi, I'm writing a application for WinCE 5 and 6 platform. I ve included battery meter, and using device DLL function to get battery status (function GetSystemPowerStatusEx is also performing good) and I m using Timer to call the function.
To avoid this I want to intercept a system message or receive a notification from system that the battery info changed and then update the meter on application.
Below is the text I found, but it's related to .NET platform.
I found this text regarding this problem:
http://english.tebyan.net/newindex.aspx?pid=31159&BookID=23937&PageIndex=125&Language=3Can you tell me which message I should intercept so that I can get notified of system power change?
I see that the coredll.dll has some notification functions, but I'm not sure it's the right direction.
Thank you
Power Notifications
One of the more welcome features of the Power Manager is its ability to notify an application when the power state of the system changes.
This ability frees the application from polling the battery state manually to monitor the power. An application can request that the Power Manager send a notification to the application when the power state of the system changes by calling RequestPowerNotifications. The Power Manager then sends the notifications through a message queue that has been previously created by the application.
RequestPowerNotifications is prototyped as
HANDLE RequestPowerNotifications (HANDLE hMsgQ, DWORD Flags);
The first parameter is the handle to a message queue that the application has previously created. The second parameter is a series of flags indicating which notifications the application wants to receive. The flags, which can be ORed together, are as follows:
PBT_TRANSITION Receive notifications when the power state changes—for example, when the system goes from On to Suspend.
PBT_RESUME Receive notifications when the system resumes.
PBT_POWERSTATUSCHANGEReceive notifications when the system transitions between AC and battery power.
PBT_POWERINFOCHANGE Receive notifications when the power information, such as the battery level, changes.
POWER_NOTIFY_ALL Receive all power notifications.