Search code examples
winapiwindows-mobilewindows-messages

WM_ACTIVATEAPP on Windows Mobile 6


There's WM_ACTIVATEAPP message on "desktop Windows":

Sent when a window belonging to a different application than the active window is about to be activated. The message is sent to the application whose window is being activated and to the application whose window is being deactivated.

Is there anything similar on Windows Mobile? WM_ACTIVATE cannot be used, as my application has multiple windows.

I need WM_ACTIVATEAPP (or something similar), because I'd like to request/release some power-consuming resources (GPS, backlight etc) when app gets activated/deactivated.


Solution

  • I think WM_ACTIVATEAPP is not supported on windows mobile. To detect when app is activated/deactivated you can capture WM_ACTIVATE message. As per MSDN documentation, hWndPrevious i.e. lParam will always be NULL when the window being activated and the window being deactivated are in separate processes. Following post makes use of same concept to address this issue. Hope this helps you. http://social.msdn.microsoft.com/forums/en-US/vssmartdevicesnative/thread/3fbe52b6-a895-4470-8cfe-c3d86a58fd73/