This message is sent when a window is being activated or deactivated. This message is sent first to the window procedure of the top-level window being deactivated; it is then sent to the window procedure of the top-level window being activated.
At a Glance
Header file: | Winuser.h |
Windows CE versions: | 1.0 and later |
Syntax
WM_ACTIVATE fActive = LOWORD(wParam);
fMinimized = (BOOL)HIWORD(wParam); hwnd = (HWND) lParam;
Parameters
fActive
Value of the low-order word of wParam. Specifies whether the window is being activated or deactivated. It is one of the following values:
Value | Description |
WA_ACTIVE | Activated by some method other than a mouse click (for example, by a call to the SetActiveWindow function or by use of the keyboard interface to select the window). |
WA_CLICKACTIVE | Activated by a mouse click |
WA_INACTIVE | Deactivated |
fMinimized
Value of the high-order word of wParam. Specifies the minimized state of the window being activated or deactivated. A nonzero value indicates the window is minimized.
hwndPrevious
Handle to the window being activated or deactivated, depending on the value of the fActive parameter. If the value of fActive is WA_INACTIVE, hwndPrevious is the handle to the window being activated. If the value of fActive is WA_ACTIVE or WA_CLICKACTIVE, hwndPrevious is the handle to the window being deactivated. This handle can be NULL.
Return Values
An application should return zero if it processes this message.
Default Action
If the window is being activated and is not minimized, the DefWindowProc function sets the keyboard focus to the window.
Remarks
The fMinimized parameter must be zero.
If the window is activated by a mouse click, it also receives a WM_MOUSEACTIVATE message.
See Also
This message is used by applications to help define private messages, usually of the form WM_APP+X, where X is an integer value.
At a Glance
Header file: | Winuser.h |
Windows CE versions: | 1.0 and later |
Syntax
WM_APP 0x8000
Remarks
The WM_APP constant is used to distinguish between message values that are reserved for use by the system and values that can be used by an application to send messages within a private window class. There are five ranges of message numbers.
Range | Description |
From 0 through WM_USER –1 | Messages reserved for use by the system. |
From WM_USER through 0x7FFF | Integer messages for use by private window classes. |
WM_APP through 0xBFFF | Messages available for use by applications. |
0xC000 through 0xFFFF | String messages for use by applications. |
Greater than 0xFFFF | Reserved by the system for future use. |
Message numbers in the first range (from 0 through WM_USER –1) are system-defined. Values not explicitly defined in this range are reserved for use by the system.
Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.
Message numbers in the third range (from 0x8000 through 0xBFFF) are available for application to use as private messages. Message in this range do not conflict with system messages.
Message numbers in the fourth range (from 0xC000 through 0xFFFF) are defined at run time when an application calls the RegisterWindowMessage function to retrieve a message number for a string. All applications that register the same string can use the associated message number for exchanging messages. The actual message number, however, is not a constant and cannot be assumed to be the same between different sessions.
Message numbers in the fifth range (greater than 0xFFFF) are reserved for use by the system.
See Also