custom cursor flickers
Posted: 06 Aug 2022, 13:23
Hi,
I have an AHK Gui on which i want to detect mouse drags.
The user is supposed to drag to move controls on the GUI.
Therefore I want to set a custom cursor to reflect that functionality.
But when I do it the custom curster flickers.
What could I do to have constant custom cursor while draging?
BTW: Using a the hotkey ~LButton:: didn't catch all the drags, so I switched to OnMessage().
I have an AHK Gui on which i want to detect mouse drags.
The user is supposed to drag to move controls on the GUI.
Therefore I want to set a custom cursor to reflect that functionality.
But when I do it the custom curster flickers.
What could I do to have constant custom cursor while draging?
BTW: Using a the hotkey ~LButton:: didn't catch all the drags, so I switched to OnMessage().
Code: Select all
CoordMode, Mouse, Screen
Gui, Show, w300 h 300, Test MouseMoveDrag
SIZEALL := DllCall("LoadCursor","UInt",NULL,"Int",32646,"UInt")
OnMessage(0x200,"MouseMoveDrag")
Return
; ~LButton:: MouseMoveDrag()
MouseMoveDrag(){
global SIZEALL
MouseGetPos, begin_x, begin_y
; ToolTip, % begin_x ", " begin_y
If !GetKeyState("LButton")
Return
DllCall("SetCursor","UInt", SIZEALL)
while GetKeyState("LButton")
{
DllCall("SetCursor","UInt", SIZEALL)
MouseGetPos, x, y
ToolTip, % begin_x ", " begin_y "`n" Abs(begin_x-x) " x " Abs(begin_y-y)
Sleep, 10
}
ToolTip
}
Esc:: ExitApp