CWnd::SetOwner

Sets the current window's owner to the specified window object.

void SetOwner( 
   CWnd* pOwnerWnd  
);

Parameters

  • pOwnerWnd
    Identifies the new owner of the window object. If this parameter is NULL, the window object has no owner.

Remarks

This owner can then receive command messages from the current window object. By default, the parent of the current window is its owner.

It is often useful to establish connections between window objects that are unrelated to the window hierarchy. For example, CToolBar sends notifications to its owner instead of to its parent. This allows the toolbar to become the child of one window (such as an OLE container application window) while sending notifications to another window (such as the in-place frame window). Furthermore, when a server window is deactivated or activated during in-place editing, any window owned by the frame window is hidden or shown. This ownership is explicitly set with a call to SetOwner.

The ownership concept of this function is different from the ownership concept of GetWindow.

Requirements

Header: afxwin.h

See Also

Concepts

CWnd Members

Reference

CWnd Class

Hierarchy Chart

CWnd::GetOwner

CToolBar Class