WM_ACTIVATEAPP

This message is sent when a window being activated belongs to a different application than the currently active window. The message is sent to the application whose window will be activated and the application whose window will be deactivated.

Parameter Description  

wParam Specifies whether a window is being activated or deactivated. A nonzero value indicates that Windows will activate a window; zero indicates that Windows will deactivate a window.  
lParam Contains the task handle of the application. If the wParam parameter is zero, the low-order word of the lParam parameter contains the task handle of the application that owns the window that is being deactivated. If wParam is nonzero, the low-order word of lParam contains the task handle of the application that owns the window that is being activated. The high-order word is not used.