Using timer perhaps:
VB Code:
Option Explicit
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 Form_Load()
Timer1.Enabled = True
Timer1.Interval = 100 '1/10 of a second
End Sub
Private Sub Timer1_Timer()
'==================================
Dim Rec As RECT, Point As POINTAPI
Dim cbOpen As Boolean
DoEvents
GetWindowRect HScroll1.hwnd, Rec
GetCursorPos Point
'check if cursor is over combobox
If Point.X >= Rec.Left And Point.X <= Rec.Right And Point.Y >= Rec.Top And Point.Y <= Rec.Bottom Then
Debug.Print "MousePointer is over Horizontal Scrollbar"
Else
Debug.Print "MousePointer is outside Horizontal Scrollbar"
End If
End Sub