VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



How to detect if mousewheel scrolls

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 Declarations
Private 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

Rate How to detect if mousewheel scrolls

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.

Download this snippet    Add to My Saved Code

How to detect if mousewheel scrolls Comments

No comments have been posted about How to detect if mousewheel scrolls. Why not be the first to post a comment about How to detect if mousewheel scrolls.

Post your comment

Subject:
Message:
0/1000 characters