WM_PARENTNOTIFY

Version 3.0

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.

Parameter

Description

 

wParam

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

 
 

Value

Meaning

 

WM_CREATE

The child window is being created.

 

WM_DESTROY

The child window is being destroyed.

 

WM_LBUTTONDOWN WM_MBUTTONDOWN WM_RBUTTONDOWN

The user has clicked on a child window.

lParam

Contains the window handle of the child window in its low-order word and the ID of the child window in its high-order word if 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.