共用方式為


CWindow::SetParent

Changes the parent window.

HWND SetParent( 
   HWND hWndNewParent  
) throw();

Remarks

See SetParent in the Windows SDK.

Example

// The following example attaches a HWND to the CWindow object 
// and sets the hWndParent as the parent window of the  
// window wrapped by CWindow object using CWindow::SetParent.

CWindow myWindow;
myWindow.Attach(hWndChild);
HWND hWndPrevParent = myWindow.SetParent(hWndParent);

Requirements

Header: atlwin.h

See Also

Reference

CWindow Class

CWindow::GetParent