Intercepting a drag event

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Ryder
Posts: 61
Joined: 28 Apr 2022, 18:49

Intercepting a drag event

Post by Ryder » 16 Aug 2022, 11:59

Hi all,

I've written a bit of code that intercepts mouse wheel up/down events that happen over a GUI button, and sends them someplace else:

Code: Select all

WinTitle := "MyText.txt - Notepad"

Gui, Margin, 10, 10
Gui, Add, Button, w80 h24 HWNDhButton1, Button 1
Gui, Show, w400 h200, Example
WinSet, AlwaysOnTop, On, Example	;Always on top is ON
return

WheelDown::							;Scroll down detected
	MouseGetPos, MouseX, MouseY, MouseWin, MouseCtl, 2	;Get MouseCtl
	
	If (MouseCtl = hButton1) {				;Check if cursor is over button
		ControlClick, x100 y800 ,%WinTitle%, , WheelDown 		;Send WheelDown to the window
	}
return
I'd like to modify this (if possible), to do basically the same thing with a mouse click/drag event... and to have it happen in real time, and by this I mean, that the drag action happening over the GUI button is instantaneously sent to another window (probably to an x,y location?), AKA "the target". This is so the operator feels that they have direct control over the target.

If the above approach is not a good foundation for this, I'm happy to scrap it and start fresh.

Ideas?

Thanks for your kind help.

R

Return to “Ask for Help (v1)”