请问如何获取一个窗体的HWND????

解决方案 »

  1.   

    CWnd* GetDlgItem( int nID ) const;void CWnd::GetDlgItem( int nID, HWND* phWnd ) const;
      

  2.   

    this->GetSafeHwnd();m_hWnd,FindWindowEx,HWND GetDlgItem(HWND,nID);
      

  3.   

    应该用 hWnd->GetSafeHwnd(); // 取得安全的 HWND 句柄
      

  4.   

    you sould first obtain the pointer of the window, assume it is  CWnd* pWndthen it will be easy to get the Handle of the window.HWND hWnd=pWnd.GetSafeHwnd( );
    or just 
    HWND hWnd=pWnd.m_hWnd;
    and with the hWnd ,you can also get the pointer of the same window.CWnd *pWnd=FromHandle(hWnd);
      

  5.   

    you should first obtain the pointer of the window, assume it is  CWnd* pWndthen it will be easy to get the Handle of the window.HWND hWnd=pWnd.GetSafeHwnd( );
    or just 
    HWND hWnd=pWnd->m_hWnd;
    and with the hWnd ,you can also get the pointer of the same window.CWnd *pWnd=FromHandle(hWnd);