This documentation is archived and is not being maintained.


Call this member function to get a pointer to a child window's parent window or owner window.

CWnd* GetParentOwner( ) const;

A pointer to a CWnd object. If a CWnd object is not attached to the handle, a temporary CWnd object is created and attached. The pointer may be temporary and should not be stored for later use.

GetParentOwner returns a pointer to the most immediate parent or owner window that is not a child window (does not have the WS_CHILD style). The current owner window can be set with SetOwner. By default, the parent of a window is its owner.

In contrast, the GetParent function returns a pointer to the immediate parent, whether it is a child window or not. If you have a child window within a child window GetParent and GetParentOwner return different results.

Header: afxwin.h