Solved

Hack to simulate mouse-move for a combo box

Posted on 2006-11-16
6
266 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

708 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

16 Experts available now in Live!

Get 1:1 Help Now