处理 WM_MOVE ,使用 SetWindowPos() 移动另外一个窗口

解决方案 »

  1.   

    void CMainFrame::OnWindowPosChanging( WINDOWPOS* lpwndpos )
    {
         CFrameWnd::OnWindowPosChanging(lpwndpos);
            m_pMyWnd1->SetWindowPos(NULL , theX , theY , 0 , 0 , SWP_NOSIZE);
         m_pMyWnd2->SetWindowPos(NULL , theX , theY , 0 , 0 , SWP_NOSIZE);
         ....
    }
      

  2.   

    在这里我使用的是两个对话框,一个是主对话框,另一个是非模式对话框,因此,用下面方法并不能很好的解决这个问题void CMainFrame::OnWindowPosChanging( WINDOWPOS* lpwndpos )
    {
        CFrameWnd::OnWindowPosChanging(lpwndpos);
          m_pMyWnd1->SetWindowPos(NULL , theX , theY , 0 , 0 , SWP_NOSIZE);
        m_pMyWnd2->SetWindowPos(NULL , theX , theY , 0 , 0 , SWP_NOSIZE);
        ....