为什么不能释放鼠标?释放了鼠标之后光标不能移出区域。
void CEEGDemoDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
SetCapture();
m_bMove=true; CDialog::OnLButtonDown(nFlags, point);
}void CEEGDemoDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (m_bMove)
{
CRect r;
m_CtrMap.GetWindowRect(&r); //m_CtrMap是一个edit控件
ClipCursor(&r);
}
CDialog::OnMouseMove(nFlags, point);
}void CEEGDemoDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
ReleaseCapture();
m_bMove=false; CDialog::OnLButtonUp(nFlags, point);
}
void CEEGDemoDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
SetCapture();
m_bMove=true; CDialog::OnLButtonDown(nFlags, point);
}void CEEGDemoDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (m_bMove)
{
CRect r;
m_CtrMap.GetWindowRect(&r); //m_CtrMap是一个edit控件
ClipCursor(&r);
}
CDialog::OnMouseMove(nFlags, point);
}void CEEGDemoDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
ReleaseCapture();
m_bMove=false; CDialog::OnLButtonUp(nFlags, point);
}
ClipCursor(NULL);
ClipCursor(NULL);
[in] Long pointer to the RECT structure that contains the screen coordinates of the upper-left and lower-right corners of the confining rectangle. If this parameter is NULL, the cursor is free to move anywhere on the screen