views:

468

answers:

1

In Windows Mobile PocketPC/Pro, you can specify that the Minimize button be used to Close the form instead (triggering the Closing event, etc.) by setting MinimizeBox = 'false'. On a Smartphone, the Back button is used in the same way as the X in the PocketPC form's corner, but I can't seem to find an obvious (or less obvious) feature to allow me to change its behavior to be "Close", not "Minimize".

Any clues on how to go about that?

+2  A: 

This is an article on capturing the Back button. There is also a sample in the SDK.

In my opinion however, you shouldn't override its functionality. Another approach you could follow is to start a timer on the OnDeactivate handler of your form. Assuming that your main form isn't hidden by another form in your application, this will be called when your application goes in background. If you have more than one form, more work is needed to capture the event of going in the background. If the user, doesn't bring your application at the foreground in a reasonable amount of time, then close it.

kgiannakakis
The reason I want to close the window is our application runs as a background app with multiple entry points. Having one entry point's window(s) minimized, then using another entry point, causes issues.I've attempted to capture the Back button with OVERRIDEKEY message, but unfortunately in .NET Compact you can't override the standard Form WndProc, so processing the WM_HOTKEY message doesn't seem possible.I might just have to rethink the architecture for a while. Its platform-agnostic code shared between WM and BlackBerry, so it's a balancing act between the two paradigms.