Solved

how to detect the mouse leave?

Posted on 1998-08-29
4
144 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

733 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