Solved

Hack to simulate mouse-move for a combo box

Posted on 2006-11-16
6
269 Views
Last Modified: 2010-04-30
Hi Experts
I have a form with checkboxs, textboxs, command buttons etc.
I use a custom tooltip based on mousemove using the hwnd of the control
The combox does not have a mousemove to open my tooltips.
Does anyone know of a workaround or a solutaion?
0
Comment
Question by:isnoend2001
  • 3
  • 2
6 Comments
 
LVL 19

Accepted Solution

by:
BrianGEFF719 earned 250 total points
ID: 17962285
Hi Isnoend2001,

Here is a function that I wrote for you, put the code in a timer with interval 100 or so.




Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type
Private Type POINTAPI
        x As Long
        y As Long
End Type

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long

Private Sub Timer1_Timer()
Dim lCmbHwnd As Long, lRet As Long
Dim rRect As RECT, mPoint As POINTAPI

lCmbHwnd = Combo1.hwnd

If (GetWindowRect(lCmbHwnd, rRect)) Then
    GetCursorPos mPoint
   
    If (rRect.Left <= mPoint.x And rRect.Right >= mPoint.x) And _
       (rRect.Top <= mPoint.y And rRect.Bottom >= mPoint.y) Then
            'user is in the region of the combo box
            MsgBox "Hello"
    End If
End If

End Sub





Good Luck!
Brian
0
 
LVL 27

Expert Comment

by:Ark
ID: 17962443
0
 

Author Comment

by:isnoend2001
ID: 17962700
Thanks guys
My program is dowloaded and installed on customers machines and i try to keep it small.
adding a timer adds another ocx, seems it was pretty big.
I have tons of custom tool tips installed and do not want redo them or add another dll to distribute.
I am looking for simple hack.
If not i guess i will stick with plain small vb tooltip

0
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.

 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 17962711
A timer is not an additional OCX.

The code I've provided is about as small as it gets. The code I've suggested only uses the Windows API.

Brian
0
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 17962712
My code will simply tell you when the mouse is over a combo box.
0
 

Author Comment

by:isnoend2001
ID: 17963114
I was thinking the last couple yrs the timer was an additional ocx
thank you
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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

919 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

18 Experts available now in Live!

Get 1:1 Help Now