When the user clicks an inactive top-level window or the child window of a inactive top-level window, Windows sends the WM_MOUSEACTIVATE message (among others) to the top-level or child window. Windows sends this message after posting the WM_NCHITTEST message to the window, but before posting the button down message. When the WM_MOUSEACTIVATE message is passed to the DefWindowProc function, Windows activates the top-level window and then posts the button down message to the top-level or child window.
By processing the WM_MOUSEACTIVATE message, a window can control whether the top-level window becomes the active window as a result of a mouse click, and whether the window that was clicked receives the subsequent button down message. It does so by returning one of the following values after processing the WM_MOUSEACTIVATE message:
Value | Meaning |
MA_ACTIVATE | Activate the window. |
MA_NOACTIVATE | Do not activate the window. |
MA_ACTIVATEANDEAT | Activate the window and discard the mouse message. |
MA_NOACTIVATEANDEAT | Do not activate the window and discard the mouse message. |