开发者

Where should I catch WM_HIBERNATE and WM_CLOSE in Windows Mobile/WinCE?

开发者 https://www.devze.com 2022-12-28 02:02 出处:网络
I have read about Windows Mobile\'s X button\'s behaviour and also about WM_HIBERNATE and WM_CLOSE which are sent on Low Memory Situation to all valid applications.

I have read about Windows Mobile's X button's behaviour and also about WM_HIBERNATE and WM_CLOSE which are sent on Low Memory Situation to all valid applications.

MSDN on WM_HIBERNATE:

This message is sent to an application when system resources are running low. An application should attempt to release as many resources as possible when sent this message by unloading dialog boxes, destroying windows, or freeing up as much local storage as possible without changing the internal state.

MSDN on WM_CLOSE:

This message is sent as a signal that a window or an application should terminate.

Questions:

  1. Are the me开发者_运维技巧ssages sent only to the top-level windows or all windows in valid applications?
  2. Where should I catch the message? in the main message pump? in every window? or only some windows?
  3. If I am using MFC, where should I catch it?


You only need to catch these messages in one form (or one control, native window class etc.). Since you definitely want one that will be around for the lifetime of your application, the main form is an appropriate choice.

0

精彩评论

暂无评论...
验证码 换一张
取 消