Hi all,
I need to intercept mousewheel movement and direct it to another (titled) window... but no clue how...
I suppose it's ok to not *intercept* it (ie, prevent it acting on current window), and duplicating it on another window, but it's best to intercept it.
Ideas?
Thank you!!!
Intercepting mousewheel Topic is solved
Re: Intercepting mousewheel
Hi
I can only think of using a settimer where the mouse position is recorded in a file (FileAppend or in an array) through the MouseGetPos command. The MouseMove command would then be used to replicate it, modifying each value to make it work on the second monitor.
On this page they do something similar, but of the times the left mouse button is clicked: viewtopic.php?t=73287
I can only think of using a settimer where the mouse position is recorded in a file (FileAppend or in an array) through the MouseGetPos command. The MouseMove command would then be used to replicate it, modifying each value to make it work on the second monitor.
On this page they do something similar, but of the times the left mouse button is clicked: viewtopic.php?t=73287
Re: Intercepting mousewheel
Code: Select all
; Disable "Scroll inactive windows when I hover over them" in Windows Mouse settings
WheelDown::
hWnd := WinActive("A")
WinActivate, ahk_exe notepad.exe
SoundBeep, 1500
#If hWnd
WheelDown::
Send {WheelDown}
SetTimer, Back, -400
Return
#If
Back:
WinActivate, ahk_id %hWnd%
SoundBeep, 1000
hWnd := False
Return
Re: Intercepting mousewheel
This solution works very well... THANK YOU!
Ryder
Ryder
Re: Intercepting mousewheel
mikeyww wrote: ↑12 Aug 2022, 20:31Code: Select all
; Disable "Scroll inactive windows when I hover over them" in Windows Mouse settings WheelDown:: hWnd := WinActive("A") WinActivate, ahk_exe notepad.exe SoundBeep, 1500 #If hWnd WheelDown:: Send {WheelDown} SetTimer, Back, -400 Return #If Back: WinActivate, ahk_id %hWnd% SoundBeep, 1000 hWnd := False Return
Now if I could ask another question to properly implement this... how would one change it so that it worked ONLY when the mouse was over a certain GUI button?
In other words... imagine this firing ONLY when I put the mouse over the "Scroll Here" GUI button...
Thank you again for your kind help,
R
Re: Intercepting mousewheel Topic is solved
I was able to use this approach instead... seems to work properly! Much simpler than I thought it would be. Yay!Ryder wrote: ↑15 Aug 2022, 11:42Now if I could ask another question to properly implement this... how would one change it so that it worked ONLY when the mouse was over a certain GUI button?
In other words... imagine this firing ONLY when I put the mouse over the "Scroll Here" GUI button...
Thank you again for your kind help,
R
Code: Select all
#SingleInstance, Force
Gui, Margin, 10, 10
Gui, Add, Button, w80 h24 HWNDhButton1, Button 1
Gui, Show, w400 h200, Example
WinSet, AlwaysOnTop, On, Example
return
WheelDown::
MouseGetPos, MouseX, MouseY, MouseWin, MouseCtl, 2
If (MouseCtl = hButton1) {
ControlClick, ,MyText.txt - Notepad, , WheelDown
}
return
WheelUp::
MouseGetPos, MouseX, MouseY, MouseWin, MouseCtl, 2
If (MouseCtl = hButton1) {
ControlClick, ,MyText.txt - Notepad, , WheelUP
}
return
Re: Intercepting mousewheel
Nice. I actually had some problems with my earlier script, so your update looks like an improvement.