m_hWnd)
       Then
         If (GetAsyncKeyState(vbKeyLButton) = 0) And
          (GetAsyncKeyState(vbKeyMButton) = 0) And
          (GetAsyncKeyState(vbKeyRButton) = 0) Then
            m_bTracking = False
            ReleaseCapture
            RaiseEvent MouseLeave
         End If
      ElseIf (iMsg &lt;&gt; WM_MOUSEMOVE) Then
         m_bTracking = False
         StartMouseTracking
      End If
   
   Case WM_ACTIVATE
      If (m_bTracking) Then
         m_bTracking = False
         ReleaseCapture
     