15,979
社区成员
发帖
与我相关
我的任务
分享
switch(message)
{
case WM_LBUTTONDOWN:
{
//AfxMessageBox(_T("鼠标按下"));
***your code****
}
break;
case WM_LBUTTONDBLCLK:
{
//AfxMessageBox(_T("鼠标双击"));
***your code****
}
break;
case WM_LBUTTONUP:
{
//AfxMessageBox(_T("鼠标弹起"));
***your code****
}
break;
case WM_CAPTURECHANGED:
{
//AfxMessageBox(_T("它失去捕获的鼠标"));
***your code****
}
break;
case WM_MOVING:
{
//AfxMessageBox(_T("鼠标移动"));
***your code****
}
break;
}
void CMsgTestDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (nFlags == MK_LBUTTON)
{
if (g_bSet == FALSE)
{
//移动之前去掉虚框
g_bSet = TRUE;
SystemParametersInfo(SPI_SETDRAGFULLWINDOWS,TRUE,NULL,0);
}
PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(point.x,point.y));
}
CDialog::OnMouseMove(nFlags, point);
}
LRESULT CMsgTestDlg::OnNcHitTest(CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(GetAsyncKeyState(VK_LBUTTON)==0x0000)
{
if (g_bSet == TRUE)
{
//移动之后加上虚框
g_bSet = FALSE;
SystemParametersInfo(SPI_SETDRAGFULLWINDOWS,FALSE,NULL,0);
}
}
return CDialog::OnNcHitTest(point);
}
void CTestDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(GetAsyncKeyState(VK_LBUTTON)==0)
{
TRACE("up!!!!!!!!!!\n");//-----根本进不来
}
else
{
TRACE("dn!!!!!!!!!!\n");
}
CDialog::OnLButtonDown(nFlags, point);
}
void CTestDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
if (point.y < 25 && point.x < 950)
{
PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(point.x,point.y));
}
CDialog::OnLButtonDown(nFlags, point);
}