WM_ACTIVATE

2.x

WM_ACTIVATE
fActive = wParam;                   /* activation flag */
fMinimized = (BOOL) HIWORD(lParam); /* minimized flag  */
hwnd = (HWND) LOWORD(lParam);       /* window handle   */

The WM_ACTIVATE message is sent when a window is being activated or deactivated. This message is sent first to the window procedure of the main window being deactivated and then to the window procedure of the main window being activated.

Parameters

fActive

Value of wParam. Specifies whether the window is being activated or deactivated. It can be one of the following values:

Value Description

WA_INACTIVE The window is being deactivated.
WA_ACTIVE The window is being activated through some method other than a mouse click (for example, by use of the keyboard interface to select the window).
WA_CLICKACTIVE The window is being activated by a mouse click.

fMinimized

Value of the high-order word of lParam. Specifies the minimized state of the window being activated or deactivated. A nonzero value indicates the window is minimized.

hwnd

Value of the low-order word of lParam. Identifies the window being activated or deactivated. This handle can be NULL.

Return Value

An application should return zero if it processes this message.

Comments

If the window is activated with a mouse click, it also receives a WM_MOUSEACTIVATE message.

Example

This example sets the input focus while processing the WM_ACTIVATE message:

case WM_ACTIVATE:

    if (wParam && !HIWORD(lParam))
        SetFocus(hwnd);
    break;

See Also

WM_MOUSEACTIVATE, WM_NCACTIVATE