WM_PARENTNOTIFY

This message is sent to the parent of a child window when the child window is created or destroyed, or when the user has pressed a mouse button while the cursor is over the child window. When the child window is being created, Windows sends WM_PARENTNOTIFY just before the CreateWindow or CreateWindowEx function that creates the window returns. When the child window is being destroyed, Windows sends the message before any processing to destroy the window takes place.

Parameters

wParam

Specifies the event for which the parent is being notified. It can be any of these values:

Value Description

WM_CREATE The child window is being created.
WM_DESTROY The child window is being destroyed.
WM_LBUTTONDOWN The user has placed the mouse cursor over the child window and clicked the left mouse button.
WM_MBUTTONDOWN The user has placed the mouse cursor over the child window and clicked the middle mouse button.
WM_RBUTTONDOWN The user has placed the mouse cursor over the child window and clicked the right mouse button.

The high-word of wParam contains the ID of the child window in if the low-word of wParam is WM_CREATE or WM_DESTROY. Otherwise, the high-word is unused.

lParam

Contains the window handle of the child window if the low-word of wParam is WM_CREATE or WM_DESTROY. Otherwise, lParam contains the x- and y-coordinates of the cursor. The x-coordinate is in the low-order word and the y-coordinate is in the high-order word.

Comments

This message is also sent to all ancestor windows of the child window, including the top-level window.

This message is sent to the parent of all child windows unless the child has the extended window style WS_EX_NOPARENTNOTIFY; CreateWindowEx creates a window with extended window styles. By default, child windows in a dialog box have the WS_EX_NOPARENTNOTIFY style unless the child window was created by calling the CreateWindowEx function.

See Also

CreateWindow, CreateWindowEx