Solved

how to detect the mouse leave?

Posted on 1998-08-29
4
137 Views
Last Modified: 2010-04-30
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?
0
Comment
Question by:bobhshaw
4 Comments
 
LVL 9

Accepted Solution

by:
Dalin earned 200 total points
ID: 1431793
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
 

Author Comment

by:bobhshaw
ID: 1431794
Thank you.
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1431795
Bought This Question.
0
 
LVL 10

Expert Comment

by:smegghead
ID: 2660133
Could someone tell me what the 'SetCapture' api does ??
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now