1. 程式人生 > >【框架-MFC】禁用滑鼠拖拽標題欄移動視窗

【框架-MFC】禁用滑鼠拖拽標題欄移動視窗

解決方案

過載WM_NCLBUTTONDOWN訊息

BEGIN_MESSAGE_MAP(CSliderDlg, CDialog)
     ON_WM_NCLBUTTONDOWN()
END_MESSAGE_MAP()
 
class CSliderDlg : publicCDialog
{
     afx_msg void OnNcLButtonDown(UINTnHitTest, CPointpoint);
};
void CSliderDlg::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
     // TODO: Add your message handler code here and/or calldefault
     if (HTCAPTION == nHitTest) {
         return;
     }
     CDialog::OnNcLButtonDown(nHitTest, point);
}