共用方式為


CWnd::GetParent

Call this function to get a pointer to a child window's parent window (if any).

CWnd* GetParent( ) const;

Return Value

See the Return Values section in GetParent in the Windows SDK.

Remarks

The GetParent function returns a pointer to the immediate parent (if it exists). In contrast, the GetParentOwner function returns a pointer to the most immediate parent or owner window that is not a child window (does not have the WS_CHILD style). If you have a child window within a child window GetParent and GetParentOwner return different results.

Requirements

Header: afxwin.h

See Also

Reference

CWnd Class

Hierarchy Chart

CWnd::GetAncestor

CWnd::GetParentOwner

CWnd::GetOwner

CWnd::SetOwner

CWnd::SetParent

GetParent