CWnd::OnParentNotify

Syntax

afx_msg void OnParentNotify( UINT message, LONG lParam );

Parameters

message

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.

lParam

Specifies the window handle of the child window in the low-order word and the identifier of the child window in the high-order word if message 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.

Remarks

A parent's OnParentNotify member function is called when its child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window. When the child window is being created, the system calls OnParentNotify just before the Create member function that creates CWnd returns. When the child window is being destroyed, the system calls OnParentNotify before any processing takes place to destroy CWnd.

OnParentNotify is called for all ancestor windows of the child window, including the top-level window.

All child windows except those that have the WS_EX_NOPARENTNOTIFY style send this message to their parent windows. By default, child windows in a dialog box have the WS_EX_NOPARENTNOTIFY style unless the child window was created without this style by calling the CreateEx member function.

This message-handler member function calls the Default member function. Override this member function in your derived class to handle the WM_PARENTNOTIFY message.

See Also

CWnd::CreateEx, CWnd::OnCreate, CWnd::OnDestroy, CWnd::OnLButtonDown, CWnd::OnMButtonDown, CWnd::OnRButtonDown, WM_PARENTNOTIFY, CWnd::Default