Share via


CWnd::Attach

Windows 창에 연결 된 CWnd 개체입니다.

BOOL Attach( 
   HWND hWndNew  
);

매개 변수

  • hWndNew
    Windows 창에 대 한 핸들을 지정합니다.

반환 값

성공 하면 0이 아닌. 그렇지 않으면 0입니다.

예제

이 예제에서는 Attach 및 Detach 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
   }

요구 사항

헤더: afxwin.h

참고 항목

참조

CWnd 클래스

계층 구조 차트

CWnd::Detach

CWnd::m_hWnd

CWnd::SubclassWindow