It wasn't my intention to confuse anyone - I use the generic term 'focus' due to my old-school Motif/OpenLook/XWindow background.
Let me provide an update as I did solve the problem I was having. Basically, the Today Screen parent absorbs many of the notification events you would expect your child plugin to receive. There are absolutely
NO notifications that your plugin has been covered by another window. The API GetForegroundWindow()
ALWAYS returns an HWND different from your plugin (probably the HWND of the parent in most cases, but not verified that is the always the case), so thats not an option either. Thus far I've determined there are
NO WM_ACTIVATE messages passed to the plugin (this may not be the case on Phone Edition devices or Smartphone - those have yet to be examined). So, as you can see the Today Screen world is quite a bit different from standard windows development.
You
can tell when your plugin has been made visible by watching for WM_ERASEBKGND messages. You will receive one WM_ERASEBKGND message each time your plugin is made visible. However, this isn't of much use when you can't tell if your plugin has been made non-visible in the first place.
Now the solution - at least in the case of Baseball Today. I'm using a WM_TIMER event to control my framerate at 30 FPS. Everytime I get this event I expect a page flip to occur. This in turn triggers a WM_PAINT event. If I do a few page flips and don't get the associated WM_PAINT events I know my plugin has been covered up.
This has been a frustrating problem because of the lack of documentation on Today Screens and the fact that noone has ever tried getting 30+ FPS and mixed sound out of a plugin. Its nice to actually do something noone else has done before.
The results are nothing short of fantastic. The game plays very nicely on everything from an iPAQ 3635 to an ASUS A715. I'm looking forward to having it tried on a WM2003SE device with a rotated screen. I'll be porting it over to Smartphone next week (I'm sure I'll find another load of issues there!), and the Pocket PC version is going to Beta this weekend (YAY!).
I've built up a really nice Today Screen game framework using GapiDraw 3, so if anyone is looking to develop for the Today Screen I'd love to talk to you and work out an arrangement. This has by far been the most enjoyable mobile game I've worked on thus far.
![Smile :)](./images/smilies/icon_smile.gif)