Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting Horizontal Mouse Wheel movement

I am using the mousewheel in my DotNet application, which I have done by following: MSDN MouseWheel example

But on my application it would be great to also use the existing hardware horizontal mouse wheel too. But how can I detect when this is used in .Net?

I am using Logitech RX1500 or or m-RAG97. enter image description here

Regards

-

* Solution *

Override the WinProc to catch the mouse wheel event.

MustInherit Class Win32Messages
    Public Const WM_MOUSEHWHEEL As Integer = &H20e
    'discovered via Spy++
End Class



Protected Overrides Sub WndProc(ByRef m As Message)
    MyBase.WndProc(m)
    If m.HWnd <> Me.Handle Then
        Return
    End If
    Select Case m.Msg
        Case Win32Messages.WM_MOUSEHWHEEL
            FireMouseHWheel(m.WParam, m.LParam)
            m.Result = DirectCast(1, IntPtr)
            Exit Select
        Case Else
            Exit Select

    End Select
End Sub
like image 358
Nasenbaer Avatar asked Nov 21 '25 14:11

Nasenbaer


1 Answers

This blog post shows how you can add support to a WinForms application.

like image 118
CodeNaked Avatar answered Nov 23 '25 02:11

CodeNaked



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!