Results 1 to 13 of 13

Thread: 3rd Party Combox and MouseWheel

  1. #1

    Thread Starter
    Fanatic Member clarkgriswald's Avatar
    Join Date
    Feb 2000
    Location
    USA
    Posts
    792

    3rd Party Combox and MouseWheel

    Our application uses a 3rd party combo box control fairly heavily (Arcadia PowerCombo) and one thing that has been driving me nuts is, once the dropdown list is expanded, the list does not respond to the mouse wheel. When collapsed, it will respond. I tried using some code to intercept mouse wheel messages on the parent form, but once the dropdown list is expanded, no messages come through. Any thoughts on how to solve this?

  2. #2
    Member
    Join Date
    Nov 2020
    Posts
    53

    Re: 3rd Party Combox and MouseWheel

    You can use Spy++ to see all the messages for the whole application. The normal location for it in the vb files is "C:\Program Files (x86)\Microsoft Visual Studio\Common\Tools\SPYXX.EXE"

  3. #3

    Thread Starter
    Fanatic Member clarkgriswald's Avatar
    Join Date
    Feb 2000
    Location
    USA
    Posts
    792

    Re: 3rd Party Combox and MouseWheel

    Quote Originally Posted by DrBobby View Post
    You can use Spy++ to see all the messages for the whole application. The normal location for it in the vb files is "C:\Program Files (x86)\Microsoft Visual Studio\Common\Tools\SPYXX.EXE"
    Already had tried that, unfortunately when I click outside the app, the dropdown closes and I can't get the messages for the combo box's dropdown list.

  4. #4
    Fanatic Member Episcopal's Avatar
    Join Date
    Mar 2019
    Location
    Brazil
    Posts
    598

    Re: 3rd Party Combox and MouseWheel

    Quote Originally Posted by clarkgriswald View Post
    Our application uses a 3rd party combo box control fairly heavily (Arcadia PowerCombo) and one thing that has been driving me nuts is, once the dropdown list is expanded, the list does not respond to the mouse wheel. When collapsed, it will respond. I tried using some code to intercept mouse wheel messages on the parent form, but once the dropdown list is expanded, no messages come through. Any thoughts on how to solve this?
    I'm sorry, but do you have the source or are you referring to the EXE?

  5. #5
    Fanatic Member
    Join Date
    Jun 2016
    Location
    EspaƱa
    Posts
    581

    Re: 3rd Party Combox and MouseWheel

    try using The Trick class clsTrickSubclass2.
    Code:
    Option Explicit
    
    Private Const WM_MOUSEWHEEL     As Long = &H20A
    
    Public Event MouseWheelUp()
    Public Event MouseWheelDown()
    
    Private l As Long
    Dim WithEvents FormHook  As clsTrickSubclass2
    
    Private Sub Class_Initialize()
        Set FormHook = New clsTrickSubclass2
    End Sub
    
    Private Sub Class_Terminate()
        FormHook.UnHook
        Set FormHook = Nothing
    End Sub
    
    Private Sub FormHook_WndProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long, Ret As Long, DefCall As Boolean)
        Select Case Msg
            Case WM_MOUSEWHEEL
                Dim zDelta As Long
                zDelta = (wParam \ &H10000) And &HFFFF
                If zDelta > 0 Then
                    RaiseEvent MouseWheelUp
                Else
                    RaiseEvent MouseWheelDown
                End If
            Case Else
                DefCall = True
        End Select
    End Sub
    
    Public Function setup(lhwnd As Long) As Boolean
        l = lhwnd
        setup = FormHook.Hook(lhwnd)
    End Function
    Something similar has been done using the hwnd of your control

  6. #6

    Thread Starter
    Fanatic Member clarkgriswald's Avatar
    Join Date
    Feb 2000
    Location
    USA
    Posts
    792

    Re: 3rd Party Combox and MouseWheel

    Quote Originally Posted by Episcopal View Post
    I'm sorry, but do you have the source or are you referring to the EXE?
    I am using the hook logic from here

    As far as the code, if you have a look there, I am just logging the mouse wheel messages there. If the dropdown list of the combo is expanded while the mouse wheel is scrolled, no messages appear.

  7. #7
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,902

    Re: 3rd Party Combox and MouseWheel

    can u send messages into this 3rd party combobox?
    I mean, the mouse wheel u can intercept yourself and u can also intercept the hwnd on top of the 3rd party combobox using a few API.
    so, basically.
    - subclassing mouse wheel and x/y position
    - check if x/y position is on top of combobox or when "focus"
    - check the mousewheel, and if so, send message to the combobox

    if subclassing is not working, u need to go low-level and get the mouse wheel that way.

  8. #8

    Thread Starter
    Fanatic Member clarkgriswald's Avatar
    Join Date
    Feb 2000
    Location
    USA
    Posts
    792

    Re: 3rd Party Combox and MouseWheel

    Quote Originally Posted by baka View Post
    can u send messages into this 3rd party combobox?
    I mean, the mouse wheel u can intercept yourself and u can also intercept the hwnd on top of the 3rd party combobox using a few API.
    so, basically.
    - subclassing mouse wheel and x/y position
    - check if x/y position is on top of combobox or when "focus"
    - check the mousewheel, and if so, send message to the combobox

    if subclassing is not working, u need to go low-level and get the mouse wheel that way.
    My guess is that the combo box is using a list control (or something similar) in its drop down state and it likely has an hWnd that I haven't been able to get just yet. May have to use EnumChildWindows to see if that works. Also there is no way for me to know if the dropdown is expanded, at least not via properties. You might be on the right track, but I would need to be able to capture the mouse wheel scroll, while the user is hovering the the expanded combo, and then send a scroll message to the child list of the dropdown. Still trying to figure this all out.

  9. #9

    Thread Starter
    Fanatic Member clarkgriswald's Avatar
    Join Date
    Feb 2000
    Location
    USA
    Posts
    792

    Re: 3rd Party Combox and MouseWheel

    Well even finding the two child window handles related to the 3rd party combo and hooking those using this code, the event never fires when I am wheeling over the combo's dropdown list. Any ideas?


  10. #10
    Junior Member anycoder's Avatar
    Join Date
    Jan 2025
    Posts
    21

    Re: 3rd Party Combox and MouseWheel

    Place the wheel hook on the form and use GetCursorPos and WindowFromPoint to get the window under the cursor, if it doesn't support wheel messages try simulating scroll messages (SB_LINEUP, SB_LINEDOWN) or try sending arrow key hits.

  11. #11

    Thread Starter
    Fanatic Member clarkgriswald's Avatar
    Join Date
    Feb 2000
    Location
    USA
    Posts
    792

    Re: 3rd Party Combox and MouseWheel

    Quote Originally Posted by anycoder View Post
    Place the wheel hook on the form and use GetCursorPos and WindowFromPoint to get the window under the cursor, if it doesn't support wheel messages try simulating scroll messages (SB_LINEUP, SB_LINEDOWN) or try sending arrow key hits.
    Interesting idea, although I have many forms with many combo boxes, so that may be a bit tedious to manage. It would much better if I could just pass all combos to a method on form load; more extensible, know what I mean?

  12. #12
    Addicted Member
    Join Date
    Feb 2015
    Posts
    227

    Re: 3rd Party Combox and MouseWheel

    Not sure if this is the same company which developed your combo control but maybe and maybe they still have somebody who remembers this or ?.

    http://arcadiaapm.com/

  13. #13
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,902

    Re: 3rd Party Combox and MouseWheel

    theres many different ways to do that.

    one way is to check the "hwnd" using a function that checks all the components.
    the function will check everything u have in your form. and u can "compare" if the .hwnd is the correct one,
    u can check what kind of component and u can also "tag" it, if u need for specific instructions.

    something like this:

    Code:
        Dim ctrl As Control
        
        For Each ctrl In Form1.Controls
            If TypeOf ctrl Is ComboBox Then
                
            End If
        Next
    now u can use ctrl to check any parameters, hwnd, tags, name, index etc.
    surely if u have multiple forms, each form need to send its "form", so it will loop the correct one.
    Last edited by baka; Feb 9th, 2025 at 05:15 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width