Поделиться через


CWnd::Attach

Attaches a Windows window to a CWnd object.

BOOL Attach(
   HWND hWndNew 
);

Параметры

  • hWndNew
    Specifies a handle to a Windows window.

Возвращаемое значение

Nonzero if successful; otherwise 0.

Пример

This example shows how to use Attach and Detach to map to the MDI client window.

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

Требования

Header: afxwin.h

См. также

Основные понятия

CWnd Class

CWnd Members

Hierarchy Chart

CWnd::Detach

CWnd::m_hWnd

CWnd::SubclassWindow