Solved

Hack to simulate mouse-move for a combo box

Posted on 2006-11-16
6
280 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
Independent Software Vendors: 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!

 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

738 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