Mouse Enter or Mouse Leave Event in VB

How do i find out the Mouse Enter or Mouse Leave from the Control where mouse point over on it (Like Developer 2000)?
Who is Participating?
DalinConnect With a Mentor Commented:
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
   ' Mouse Left
         'Do something else
 End If
Yep, saw this myself recently. Good tip.

See also Karl Petersen's article in the VBPJ of... damn... forgot... twas recent anyway, August or something, or one of the recent special releases.
ghouse75Author Commented:
I need the uses of SetCapture and ReleaseCapture API funtion on your mousemove enent
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

In efforts to help all Members maintain their open questions, this is a reminder to click your Member Profile, expand your question history and find/update all your Open and Locked questions.
Thank you,
Moderator @ Experts Exchange
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.