CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    12

    Mouse Leave Event

    How do I detect when the mouse has left a control or window. I tried using TrackMouse but the function was undefined. I would like to avoid hooks also


  2. #2
    Join Date
    Apr 1999
    Posts
    306

    Re: Mouse Leave Event

    Override OnMouseMove()


  3. #3
    Join Date
    May 1999
    Posts
    40

    Re: Mouse Leave Event

    m_bMouseCaptured=FALSE;


    OnMouseMove(UINT nFlags, CPoint point)
    {
    CRect rc;
    this->GetClientRect(&rc);
    if (!rc.PtInRect(point))
    {
    if( m_bMouseCaptured==FALSE)
    {

    SetCapture();
    m_bMouseCaptured=TRUE;
    }
    }
    else
    {
    if(m_bMouseCaptured)
    {
    ReleaseCapture();
    m_bMouseCaptured=FALSE;
    }
    }
    }

    never try.
    hope help.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured