A deactivation message (that is, a WM_ACTIVATE message with usactive set to FALSE) is sent first to the window procedure of the main window being deactivated, before an activation message (that is, a WM_ACTIVATE message with usactive set to TRUE) is sent to the window procedure of the main window being activated.

Any WM_SETFOCUS messages with usfocus set to FALSE, are sent before the deactivation message. Any WM_SETFOCUS messages with usfocus set to TRUE, are sent after the activation message.

If WinSetFocus is called during the processing of a WM_ACTIVATE message, a WM_SETFOCUS message with usfocus set to FALSE is not sent, as no window has the focus.

If a window is activated before any of its children have the focus, this message is sent to the frame window or to its FID_CLIENT, if it exists.

Note: Except in the instance of a WM_ACTIVATE message, with usactive set to TRUE, an application processing a WM_ACTIVATE, or a WM_SETFOCUS message should not change the focus window or the active window. If it does, the focus and active windows must be restored before the window procedure returns from processing the message. For this reason, any dialog boxes or windows brought up during the processing of a WM_ACTIVATE, or a WM_SETFOCUS message should be system modal.