windows_programming_notes.nbk: Home | Index | Next Page: WM_POWER | Previous Page: WM_PALETTECHANGED


 WM_PARENTNOTIFY

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.

    LRESULT CALLBACK WindowProc(
      HWND hwnd,       // handle to window
      UINT uMsg,       // WM_PARENTNOTIFY
      WPARAM wParam,   // event and child window identifier
      LPARAM lParam    // child handle or cursor coordinates
    );

Parameters

Return Values

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.

Requirements


windows_programming_notes.nbk: Home | Index | Next Page: WM_POWER | Previous Page: WM_PALETTECHANGED


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time