Freigeben über


CWnd::Attach

Fügt ein Windows- zu einem CWnd-Objekt.

BOOL Attach( 
   HWND hWndNew  
);

Parameter

  • hWndNew
    Gibt ein Handle für ein Windows- an.

Rückgabewert

Ungleich 0 (null), wenn erfolgreich; 0 andernfalls.

Beispiel

Dieses Beispiel zeigt, wie Anfügen verwendet und getrennt wird, um zum MDI-Clientfenster zuzuordnen.

// Declare a CWnd member of CMainFrame
public:
   CWnd m_wndMDIClient;
// detach MDI client window in CMainFrame destructor
m_wndMDIClient.Detach();
   // In CMainFrame::OnCreate, attach MDI client window 

    if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
        return -1;

   // attach MDI client window 
   if (m_wndMDIClient.Attach(m_hWndMDIClient) == 0)
   {
      TRACE(_T("Failed to attach MDIClient.\n"));
      return -1;      // fail to create
   }

Anforderungen

Header: afxwin.h

Siehe auch

Referenz

CWnd-Klasse

Hierarchiediagramm

CWnd::Detach

CWnd::m_hWnd

CWnd::SubclassWindow