Share via


CWnd::Attach

adjunta una ventana de Windows a un objeto de CWnd .

BOOL Attach( 
   HWND hWndNew  
);

Parámetros

  • hWndNew
    Especifica un identificador de una ventana de Windows.

Valor devuelto

Distinto de cero si correctamente; si no 0.

Ejemplo

Este ejemplo muestra cómo utilizar la asociar y desasociar un para asignar a la ventana de cliente 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
   }

Requisitos

encabezado: afxwin.h

Vea también

Referencia

CWnd (clase)

Gráfico de jerarquías

CWnd::Detach

CWnd::m_hWnd

CWnd::SubclassWindow