添加鼠标左键按下响应函数:
1、 声明
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
2、 消息映射
BEGIN_MESSAGE_MAP(CDddDlg, CDialog)
//{{AFX_MSG_MAP(CDddDlg)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
3、 实现函数
void CDddDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x,point.y));
CDialog::OnLButtonDown(nFlags, point);
}
4、 扩展
编写你需要响应的函数并在实现函数中加入
PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x,point.y));
即可。