开发者

Detecting Horizontal Mouse Wheel movement

I am u开发者_开发技巧sing 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.

Detecting Horizontal Mouse Wheel movement

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜