PocketMatrix forums

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

Minimizing/Maximizing PocketHAL apps

When I minimize my application, what should I do with PHal?

Currently, I'm pausing my app, and switching from a PeekMessage message pump/game loop to a simple GetMessage loop, sending a minimize message to the window, and using SHFullScreen to re-enable the start button, taskbar etc.

As long as I use the WS_EX_TOPMOST window style, I can minimize (using an in-game button handled myself), and refocus the app cleanly.

But I'm not doing anything to deinit/reinit PHal. And it works, at least on my device(!)....

Is this expected behaviour, or should I be destroying and recreating the display object on each loss of focus/refocus? (which also works, but causes the banner to redisplay)

I've not managed to handle 'forced minimization' yet, when the device is left unused and reverts to the Today screen. Not so easy to test this one, as it involves waiting an hour or two.... may have to write a test app that runs a timer in the background then tries to maximize itself....

Also, is there an easy way to detect Activesync syncing (so I can force a minimize, and hide the gitching when it tried to update it's progress dialog)?
bluescrn wrote:When I minimize my application, what should I do with PHal?


No, nothing to do. PHAL takes care of himself. He's a grown up you know.

bluescrn wrote:But I'm not doing anything to deinit/reinit PHal. And it works, at least on my device(!)....


That's perfectly fine.

bluescrn wrote:Is this expected behaviour, or should I be destroying and recreating the display object on each loss of focus/refocus? (which also works, but causes the banner to redisplay)


It is expected behavior. PHAL can detect whether or not your window has focus.

bluescrn wrote:Also, is there an easy way to detect Activesync syncing (so I can force a minimize, and hide the gitching when it tried to update it's progress dialog)?


No idea, sorry.
Ok, cool :)

I've got my game behaving itself now by minimizing on the WM_ACTIVATE messages when the window is becoming inactive. This makes it minimize when you sync, which is much better than the glitchiness of the Activesync dialog flickering over the game window...

It's all working rather well, other than the requirement of WS_EX_TOPMOST - which seems to force it right to the back when minimized - you can't reactivate it by closing the window on top - you have to either use a task manager (no problem with an iPaq/iTask, not sure about other devices), or by attempting to start a 2nd instance (which now reactivates the old window then terminates)

I'm happy with it, anyway - I always display a minimize (x) button in the top right corner of the screen, which always responds. Far better than the majority of full-screen games, which often don't like being switched away from, and not particularly hard to implement.

I'll release another demo fairly soon as a compatibility test for this stuff.... but I want to get a bit more gameplay in there first...