Page 1 of 1

ControlClick Up releases all buttons

Posted: 23 May 2017, 00:52
by zebluk
Hi,

I noticed that when sending a ControlClick with U option (button UP), all other buttons got automatically released. A quick check at the source revealed this comes from this line (script2.cpp:2207)

Code: Select all

PostMessage(control_window, msg_up, 0, lparam);
The wParam is forced to 0 hence releasing all the buttons. To fix it, simply replace the 0 with a wParam value that reflects the real states of the other buttons. Testing with pure window messages confirmed it's enough to make it work as expected.

Thanks

Re: ControlClick Up releases all buttons

Posted: 28 Jul 2017, 20:49
by Vh_
This would be a post message error, not ControlClick :)

Re: ControlClick Up releases all buttons

Posted: 29 Jul 2017, 08:45
by guest3456
Vh_ wrote:This would be a post message error, not ControlClick :)
Uh. I don't think so.

zebluk wrote:

Code: Select all

PostMessage(control_window, msg_up, 0, lparam);
The wParam is forced to 0 hence releasing all the buttons. To fix it, simply replace the 0 with a wParam value that reflects the real states of the other buttons. Testing with pure window messages confirmed it's enough to make it work as expected.
I've always used 0 also. ControlClick and the WM_ messages are used to virtually send the clicks, compared to regular Click which is more like a physical mouse action. How would you GET the states of the other buttons to know what to even pass? Would GetKeyState suffice? And if so, would you use the Logical or Physical state?

Lastly, I think this could be considered as something that would 'break' scripts so this would probably be in consideration for AHK v2

Re: ControlClick Up releases all buttons

Posted: 29 Jul 2017, 12:07
by Vh_
Can you provide an example? I tried something with ControlClick UP and it didnt interfere with other keys

Re: ControlClick Up releases all buttons

Posted: 29 Jul 2017, 12:11
by guest3456
I haven't tested the original Bug Report so I don't know if in fact it is true or not