I tried to add some wheel acceleration code to Shimanov's script. Experiment with this
Code:
CoordMode Mouse, Screen
WheelTime = 500
WheelDelta:= 120 << 16
WheelMax := 4 * WheelDelta
WheelUp::
Critical
If (A_ThisHotKey <> A_PriorHotKey OR A_TimeSincePriorHotkey > WheelTime)
WCnt = %WheelDelta%
Else If (WCnt < WheelMax)
WCnt+= WheelDelta
MouseGetPos m_x, m_y
hw_m_target := DllCall("WindowFromPoint", "int",m_x, "int",m_y)
SendMessage 0x20A, WCnt, (m_y<<16)|m_x,,ahk_id %hw_m_target% ; WM_MOUSEWHEEL
return
WheelDown::
Critical
If (A_ThisHotKey <> A_PriorHotKey OR A_TimeSincePriorHotkey > WheelTime)
WCnt = %WheelDelta%
Else If (WCnt < WheelMax)
WCnt+= WheelDelta
MouseGetPos m_x, m_y
hw_m_target := DllCall("WindowFromPoint", "int",m_x, "int",m_y)
SendMessage 0x20A,-WCnt, (m_y<<16)|m_x,,ahk_id %hw_m_target% ; WM_MOUSEWHEEL
return
Three parameters govern the acceleration. WheelTime tells how much time should pass until we reset the wheel event counter, CntDelta tells how much the scroll amount is incremented at a time, and WheelMax limits the speed of scrolling. When the wheel is fast turned, we see many calls of the hotkey routines, and the WCnt counter is incremented. It tells how large scroll is to be performed, that is, when the wheel is turned fast, the window will scroll more at each step.
The script is considerably slower, than Windows handling the wheel (see how many wheel events are buffered). I tried
Code:
SetBatchLines -1
SetMouseDelay -1
Process Priority,,R
without any noticeable difference. Checking if the mouse position is changed, and only then call the dll WindowFromPoint, does not help either.