CWnd::Attach

Aggiunge una finestra di Windows a un oggetto CWnd.

BOOL Attach(
   HWND hWndNew 
);

Parametri

  • hWndNew
    Specifica un handle a una finestra di Windows.

Valore restituito

Diverso da zero se ha esito positivo; in caso contrario 0.

Esempio

In questo esempio viene illustrato come utilizzare connessione e disconnessione per il mapping alla finestra client MDI.

// 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
   }

Requisiti

Header: afxwin.h

Vedere anche

Riferimenti

Classe CWnd

Grafico della gerarchia

CWnd::Detach

CWnd::m_hWnd

CWnd::SubclassWindow