Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WM_MOUSEWHEEL Message to WindowProc

75 views
Skip to first unread message

Guillaume EBERHART

unread,
Oct 21, 2002, 2:31:14 PM10/21/02
to
Hi, anyone know how to use the WM_MOUSEWHEEL message ?
I have the HiWord of wParam wich is set to a multiple of 120 from -3 to 3
(with wheel acceleration)
(-360, -240, -120, 120, 240, 360)
I wanted to know how i can retreive the number of scroll lines configured in
the Mouse Control Panel.
I configured my mouse wheel to scroll 15 lines per notch,
in this way, (HIWORD(wParam)/120) * xxx
where xxx is the number of lines...

MSDN say:
LoWord(wParam) = Control Keys
HiWord(wParam) = WheelDelta
LoWord(lParam) = x
HiWord(lParam) = y

But nothing on the number of lines to scroll...

Any ideas ?
thanks.


Mike D Sutton

unread,
Oct 21, 2002, 3:31:25 PM10/21/02
to

Here you go:

'***
Private Declare Function GetSystemMetrics Lib "user32" _
(ByVal nIndex As Long) As Long
Private Declare Function SystemParametersInfo Lib "user32" Alias _
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _
ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long

Private Const SM_MOUSEWHEELPRESENT = &H4B
Private Const SPI_GETWHEELSCROLLLINES = &H68
Private Const SPI_SETWHEELSCROLLLINES = &H69 ' In case you need it

Private Sub Form_Load()
Dim NumLines As Long

' Is there a mouse wheel?
If GetSystemMetrics(SM_MOUSEWHEELPRESENT) Then
' How many lines to scroll?
Call SystemParametersInfo( _
SPI_GETWHEELSCROLLLINES, 0, NumLines, 0)
MsgBox NumLines & " lines per notch", vbInformation, "Mouse wheel"
Else
MsgBox "No mouse wheel detected..", vbInformation, "Mouse wheel"
End If

Unload Me
End Sub
'***

Hope this helps,

Mike


-- EDais --

- Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/
Work E-Mail: ED...@btclick.com
Other E-Mail: Mike....@btclick.com


0 new messages