Scrolling issue with wheelup and wheeldown

Ask gaming related questions (AHK v1.1 and older)
rainrain
Posts: 45
Joined: 20 Jan 2022, 00:17

Scrolling issue with wheelup and wheeldown

Post by rainrain » 06 Oct 2022, 21:45

Sometimes even when it isn't Winactive, the wheelup and wheeldown will continue to scroll at blazing speed out of the game, on browser sites etc.. I needed to reload ahk to make normal again.

Code: Select all

#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
DllCall("ntdll\ZwSetTimerResolution","Int",5000,"Int",1,"Int*",MyCurrentTimerResolution)

GroupAdd, gw2, Guild Wars 2
GroupAdd, gw2, `.0 0 0
#IfWinActive ahk_group gw2
DllCall("Sleep","UInt",1) ;I just slept exactly 1ms!
DllCall("ntdll\ZwDelayExecution","Int",0,"Int64*",-5000) ;you can use this to sleep in increments of 0.5ms if you need even more granularity 
RButton::evaluateButton("RButton", "F1")
Wheelup::evaluateButton("Wheelup", "8")
Wheeldown::evaluateButton("Wheeldown", "7")
evaluateButton(Button1, Button2)
{
if (isMouseShown()) {
send {%Button1% Down}
KeyWait, RButton
send {%Button1% Up}
}
else {
send {%Button2% Down}
KeyWait, % "{" A_ThisHotkey "}"
send {%Button2% Up}
}
}
isMouseShown()
{
StructSize := A_PtrSize + 16
VarSetCapacity(InfoStruct, StructSize)
NumPut(StructSize, InfoStruct)
DllCall("GetCursorInfo", UInt, &InfoStruct)
Result := NumGet(InfoStruct, 8)
return (Result != 0)
}

Rohwedder
Posts: 7551
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Scrolling issue with wheelup and wheeldown

Post by Rohwedder » 07 Oct 2022, 01:59

Hallo,
KeyWait, % "{" A_ThisHotkey "}" does not work!


Post Reply

Return to “Gaming Help (v1)”