Detecting Horizontal Mouse Wheel movement

末鹿安然 提交于 2019-12-06 10:20:08

问题


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.

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

回答1:


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



来源:https://stackoverflow.com/questions/6612352/detecting-horizontal-mouse-wheel-movement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!