Home
> Uncategorized > Supporting the Mouse Wheel in VB6
Supporting the Mouse Wheel in VB6
VB6 does not natively support the mouse wheel (The roller ball in the middle of your mouse). Thus, any programs you develop with VB6 will not support the mouse wheel either. There is a work around.
Some websites will show a "hacky solution", which can cause vb6 to crash every time you press the "stop debug button" – this approach is better.
1st stop. Download the VB subclassing DLL from VBAccelerator.com. (SSubTmr.dll)
– Add a reference to this in the project
2. Add this constant
Public Const WM_MOUSEWHEEL = &H20A
3. Add this to the top of the form
Implements ISubclass
4.Add these three functions to the code
Private Property Let ISubClass_MsgResponse(ByVal RHS As EMsgResponse)
End Property
Private Function ISubClass_WindowProc( _
ByVal hwnd As Long, _
ByVal iMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Dim rotation As Long
rotation = wParam / 65536
If rotation > 0 Then SendKeys ("{UP}")
If rotation < 0 Then SendKeys ("{DOWN}")
End Function
Private Property Get ISubClass_MsgResponse() As EMsgResponse
ISubClass_MsgResponse = emrConsume
End Property
End Property
Private Function ISubClass_WindowProc( _
ByVal hwnd As Long, _
ByVal iMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Dim rotation As Long
rotation = wParam / 65536
If rotation > 0 Then SendKeys ("{UP}")
If rotation < 0 Then SendKeys ("{DOWN}")
End Function
Private Property Get ISubClass_MsgResponse() As EMsgResponse
ISubClass_MsgResponse = emrConsume
End Property
And that’s it.
Categories: Uncategorized
Comments (0)
Trackbacks (0)
Leave a comment
Trackback