PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

How to detect PPC suspend/wakeup?

I need to handle the PPC device going suspended & waking up, due to user being inactive or pressing the Power button ( specifically, suspend/resume the sound thread that otherwise hangs the device ).

How could I get some sort of notification of this event?
Could it be the Power Manager, RequestPowerNotifications & so on? Or is there an simpler & more documented way?
check out WM_ACTIVATE & related stuff. It's a good idea to just do a search of the general developer forum as most things, this included, have been covered many times so some people will ignore the post. You can also search the PocketFrog & GapiDraw forums where these things also get covered.
The only method I'm aware of that will work with all versions of Pocket PC is to check the tick count each frame. If more than 500 or so mS has elapsed since the last frame then you know the device was powered off and back on.

Dan East
There's no event message generated on powerdowns, but there is a cumbersome method using device driver messages that works across ppc platforms. You can find a small bit of info on this if you search google.
ppcStudios wrote:There's no event message generated on powerdowns, but there is a cumbersome method using device driver messages that works across ppc platforms

Thanks a lot!
This is exactly the situation I was confused by, and the solution as well.
I've just tried recieving notifications on system power state transition from the Power Manager, and this works pretty well:
- CreateMsgQueue to recieve notifications,
- RequestPowerNotifications( that queue, PBT_TRANSITION ) from the Power Manager,
- ReadMsgQueue( that queue ), perhaps, in a separate thread. We get a POWER_BROADCAST structure, where the Flags member holds the new power state.
- ReleasePowerRelationship after all to cleanup.
The "documentation" in pm.h turns out to be quite sufficient.
heh, seems like Atomix has a problem with getting powered down in the middle of a game.