Simulated click problem on menu/sysmenu
Posted: 24 Jul 2021, 16:38
I am currently working on modifying my game controller into a fully functioning mouse. I have used evilc's library here: https://www.autohotkey.com/boards/viewtopic.php?t=28889 to create the link from the c# dll to my ahk script. I am not sure exactly how these two communicate (i think its a CLR interop) where I supply an ahk bound function as a callback.
Basically if hit my controller button that I bind to left click it sendinputs click, down. When the button is released it sendinputs click, up.
This is great in 99% of cases except on menu items or sysmenu items like Minimize and X on my own script's GUI. The click down must take us into a message loop that prevents the c# code from getting received. The controller buttons become unresponsive until I break the message loop with the real mouse.
I imagine it's something similar to lexikos's post here (near the bottom) about message loops.
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=91443
If there isn't a reasonably clean solution to this issue, how could I detect when mouse is over the minimize/close buttons or over an opened menu item? Worst case I can just block controller input on those elements since they won't work anyway. I tried sendmessage and wm_nchittest but this couldn't differentiate between caption and minmize button.
Thanks for anyone taking a look
Basically if hit my controller button that I bind to left click it sendinputs click, down. When the button is released it sendinputs click, up.
Code: Select all
sendmode, Input
if (value)
Click, down
else
Click, up
I imagine it's something similar to lexikos's post here (near the bottom) about message loops.
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=91443
If there isn't a reasonably clean solution to this issue, how could I detect when mouse is over the minimize/close buttons or over an opened menu item? Worst case I can just block controller input on those elements since they won't work anyway. I tried sendmessage and wm_nchittest but this couldn't differentiate between caption and minmize button.
Thanks for anyone taking a look