窗口拖动

定义函数:

afx_msg LRESULT OnNcHitTest(CPoint pt);

消息映射:

BEGIN_MESSAGE_MAP(CMy57projectDlg, CDialog)
    ON_WM_NCHITTEST()
END_MESSAGE_MAP()

函数实现:

LRESULT CMy57projectDlg::OnNcHitTest(CPoint pt)
{
CRect rc;
GetClientRect(&rc);
ClientToScreen(&rc);
return rc.PtInRect(pt) ? HTCAPTION : CDialog::OnNcHitTest(pt);
}
原文地址:https://www.cnblogs.com/2018shawn/p/9436934.html