Solved

Hack to simulate mouse-move for a combo box

Posted on 2006-11-16
6
284 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
[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
  • 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 28

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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
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…

728 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