by Ian Gorse (6 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (4 Votes)
This snippet will detect if the mouse wheel scrolls, it does not detect if there is a scroll up/down, i do not know how to do that.
Assumes
Add a timer, set inteval to 1.
Add a listbox.
API DeclarationsPrivate Declare Function GetMessage Lib "user32" Alias "GetMessageA" (lpMsg As Msg, ByVal hwnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
Private Declare Function DispatchMessage Lib "user32" Alias "DispatchMessageA" (lpMsg As Msg) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type Msg
hwnd As Long
message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
on the timer function, type....
Dim amsg As Msg
GetMessage amsg, 0, 0, 0
DispatchMessage amsg
If amsg.message = 522 Then
list1.additem "Mouse wheel scrolled"
end if
'that is all, hope it comes useful.