Use local variable.
Function WaitForMouseWheel
Function WaitForMouseWheel
;/
function# ^timeS direction [flags] ;;direction: 1 forward, -1 backward, 0 any; flags: 1 block event
;Waits for mouse wheel forward or backward.
;Returns: 1 forward, -1 backward.
;timeS - 0 or timeout. Error on timeout.
int R
opt noerrorshere 1
__Handle ev=CreateEvent(0 0 0 0)
__WindowsHook hook=SetWindowsHookEx(WH_MOUSE_LL &sub.Hook_WH_MOUSE_LL _hinst 0)
opt waitmsg 1
wait timeS H ev
if R > 0; ret 1
if R < 0; ret -1
#sub Hook_WH_MOUSE_LL v
function# nCode message MSLLHOOKSTRUCT&m
if(nCode<0) goto gNext
if message=WM_MOUSEWHEEL
,int v=m.mouseData
,if direction=0 or (direction>0 and v>0) or (direction<0 and v<0)
,,SetEvent ev
,,R = v
,,if(flags&1) ret 1
;gNext
ret CallNextHookEx(0 nCode message &m)