how to detect the mouse leave?

using vb4. Show tool tip when the mouse is over. however, if the mouse leaves a control quickly, the tooltip is still there. Any way to know when the mouse leave?
bobhshawAsked:
Who is Participating?
 
DalinCommented:
bobhshaw,
Try this, let me know if you have any questions.
Regards
Dalin

In the form's general declaration area, add:

  Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
  Private Declare Function ReleaseCapture Lib "user32" () As Long

In the MouseMove Event of the control, add

Dim MouseOver As Boolean
' See if the mouse is over
MouseOver = (0 <= X) And (X <= Command2.Width) And (0 <= Y) And (Y <= Command2.Height)

If MouseOver Then
 MouseOver is true
        ' Do something
        SetCapture Command2.hWnd
  Else
   ' Mouse Left
         'Do something else
         ReleaseCapture
 End If
0
 
bobhshawAuthor Commented:
Thank you.
0
 
MirkwoodCommented:
Bought This Question.
0
 
smeggheadCommented:
Could someone tell me what the 'SetCapture' api does ??
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.