/*鼠标被捕获后,系统会一直发出WM_MOUSEMOVE消息,但如果鼠标离开窗口,是否还会发送次消息?*/

解决方案 »

  1.   

    会的啊。如果你用了SetCapture函数,就算鼠标移动到窗口外,窗口也能接收到消息。
    停止捕获,用ReleaseCapture();
      

  2.   

    *鼠标被捕获后,系统会一直发出WM_MOUSEMOVE消息,但如果鼠标离开窗口,是否还会发送次消息?*/
    ----------------
    是还会接受到消息~
      

  3.   

    void CTmpMFCView::OnMouseMove(UINT nFlags, CPoint point) 
    {
    CClientDC dc(this);
    CString msg;
    if(bIsCapture)//BOOL变量,在单击客户区时候,变为真.
    {
    SetCapture();
         msg.Format("capture:(%d,%d)",point.x,point.y);
    }
    else
    {
    msg.Format("(%d,%d)",point.x,point.y);
    } Invalidate();
    UpdateWindow();
    dc.TextOut(50,50,msg);
    }
    但我鼠标移到窗口外面,客户区就不反映当前鼠标坐标了
      

  4.   

    单单在OnLButtonDown下设置bIsCapture = TRUE;是会出现你描述的对象
    一般做法是OnLButtonDown中SetCapture();然后OnLButtonUp中ReleaseCapture();
      

  5.   

    MSDN的说法,button is still down
    SetCapture captures mouse input either when the mouse is over the capturing window, or when the mouse button was pressed while the mouse was over the capturing window and the button is still down. Only one window at a time can capture the mouse. If the mouse cursor is over a window created by another thread, the system will direct mouse input to the specified window only if a mouse button is down. 
      

  6.   

    鼠标被捕获后,系统会一直发出WM_MOUSEMOVE消息,但如果鼠标离开窗口,是否还会发送次消息?
      

  7.   

    当鼠标按下才发给GetCapture窗口,否则即使SetCapture也不理
    only if a mouse button is down. 
      

  8.   

    http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=206973