void CTestbed2Dlg::OnRButtonDown(UINT nFlags, CPoint point) { ClientToScreen (&point); m_LastPoint = point; m_bMoving = TRUE; } // ------------------------------------------------------------------------ void CTestbed2Dlg::OnMouseMove(UINT nFlags, CPoint point) { RECT cr; ClientToScreen (&point); if (m_bMoving) { if ((point.x != m_LastPoint.x) || (point.y != m_LastPoint.y) ) { GetWindowRect (&cr); int iX = cr.left - (m_LastPoint.x - point.x); int iY = cr.top - (m_LastPoint.y - point.y); int iWidth = cr.right - cr.left; int iHeight = cr.bottom - cr.top; MoveWindow (iX, iY, iWidth, iHeight); } m_LastPoint = point; } else CDialog::OnMouseMove(nFlags, point); } // ------------------------------------------------------------------------ void CTestbed2Dlg::OnRButtonUp(UINT nFlags, CPoint point) { if (m_bMoving) m_bMoving = FALSE; else CDialog::OnMButtonUp(nFlags, point); }