WM ACTIVATE
This message occurs when an application causes the activation or deactivation of a window.
Syntax
param1 USHORT usactive /* Active indicator. */ param2 HWND hwnd /* Window handle. */
Parameters
- usactive (USHORT)
- Active indicator.
- TRUE
- he window is being activated
- FALSE
- The window is being deactivated.
- hwnd (HWND)
- Window handle.
- In the case of activation, hwnd identifies the window being activated. In the case of deactivation, hwnd identifies the window being deactivated.
Returns
- ulReserved (ULONG)
- Reserved value, should be 0.
Remarks
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.
Default Processing
The default window procedure takes no action on this message, other than to set ulReserved to 0.
Related Messages
- WM_ACTIVATE (in Frame Controls)
- WM_ACTIVATE (Language Support Dialog)
- WM_ACTIVATE (Language Support Window)