Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windowing
Windows
Windows Reference
Notifications
 WM_PARENTNOTIFY Notification
WM_PARENTNOTIFY Notification

The WM_PARENTNOTIFY message is sent to the parent of a child window when the 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 sends WM_PARENTNOTIFY just before the CreateWindow or CreateWindowEx function that creates the window returns. When the child window is being destroyed, the system sends the message before any processing to destroy the window takes place.

A window receives this message through its WindowProc function.

Syntax

WM_PARENTNOTIFY

    WPARAM wParam
    LPARAM lParam;
    

Parameters

wParam
The low-order word of wParam specifies the event for which the parent is being notified. This parameter can be one of the following values.
WM_CREATE
The child window is being created.
WM_DESTROY
The child window is being destroyed.
WM_LBUTTONDOWN
The user has placed the cursor over the child window and has clicked the left mouse button.
WM_MBUTTONDOWN
The user has placed the cursor over the child window and has clicked the middle mouse button.
WM_RBUTTONDOWN
The user has placed the cursor over the child window and has clicked the right mouse button.
WM_XBUTTONDOWN
Windows 2000/XP: The user has placed the cursor over the child window and has clicked the first or second X button.
The following table shows values of the low-order word of wParam and the corresponding meanings of the high-order word of wParam.
LOWORD(wParam)
Meaning of HIWORD(wParam)
WM_CREATE
Identifier of the child window.
WM_DESTROY
Identifier of the child window.
WM_LBUTTONDOWN
Undefined.
WM_MBUTTONDOWN
Undefined.
WM_RBUTTONDOWN
Undefined.
WM_XBUTTONDOWN
Windows 2000/XP: Indicates which button was pressed. This parameter can be one of the following values: XBUTTON1

XBUTTON2

lParam
The following table shows values of the low-order word of wParam and the corresponding meanings of lParam.
WM_CREATE
Handle of the child window.
WM_DESTROY
Handle of the child window.
WM_LBUTTONDOWN
The x-coordinate of the cursor is the low-order word, and the y-coordinate of the cursor is the high-order word.
WM_MBUTTONDOWN
The x-coordinate of the cursor is the low-order word, and the y-coordinate of the cursor is the high-order word.
WM_RBUTTONDOWN
The x-coordinate of the cursor is the low-order word, and the y-coordinate of the cursor is the high-order word.
WM_XBUTTONDOWN
The x-coordinate of the cursor is the low-order word, and the y-coordinate of the cursor is the high-order word.

Return Value

If an application processes this message, it should return zero.

Remarks

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

All child windows, except those that have the WS_EX_NOPARENTNOTIFY extended window style, send this message to their parent windows. By default, child windows in a dialog box have the WS_EX_NOPARENTNOTIFY style, unless the CreateWindowEx function is called to create the child window without this style.

Notification Requirements

Minimum DLL Version None
HeaderDeclared in Winuser.h, include Windows.h
Minimum operating systems Windows 95, Windows NT 3.1

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Value      Đonny   |   Edit   |   Show History
WM_PARENTNOTIFY = &H210
Public Enum WM_PARENTNOTIFY_WM_XBUTTONDOWN_high As Short
XBUTTON1 = &H1
XBUTTON2 = &H2
End Enum
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker