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
Printable View
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
Override OnMouseMove()
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.