Anyone got any experiences in posting mouse events in Qt5 apps?

Ask gaming related questions (AHK v1.1 and older)
User avatar
Brazolek123
Posts: 187
Joined: 06 Jun 2016, 16:02

Anyone got any experiences in posting mouse events in Qt5 apps?

17 Oct 2017, 04:26

I'm asking because all mouseclick methods i've used failed less or more miserably. I'm talking about trying to send mouse event lbutton or rbutton to inactive but not minimized window.
Using ext. dll caused click on different menus inside app with different position offsets (whats is kinda strange, never happen to me before). Trying to use ahk post/send message causes proper click in proper position but 'virtual' mouse seem to 'stay' in clicked menu, even if after click I call postmessage to mousemove to different place.

Whats is more funny if target window was not active but still visible through another active but not maximized window, mouse click worked perfectly, so it seems like game read not only virtual or real mouse cursor pos but also if game window is visible.

I'm sorry I'm posting without any screenshoots or core, but my question is more like "if there are any specific rules to handle Qt5 applications?", than "help my code doesnt work".

Also if you have any mouse clicks dlls you used in other games I'd be grateful if I can test them.
User avatar
Reloaded
Posts: 283
Joined: 25 Aug 2017, 08:48

Re: Anyone got any experiences in posting mouse events in Qt5 apps?

17 Oct 2017, 05:28

Brazolek123 wrote:I'm asking because all mouseclick methods i've used failed less or more miserably. I'm talking about trying to send mouse event lbutton or rbutton to inactive but not minimized window.
Using ext. dll caused click on different menus inside app with different position offsets (whats is kinda strange, never happen to me before). Trying to use ahk post/send message causes proper click in proper position but 'virtual' mouse seem to 'stay' in clicked menu, even if after click I call postmessage to mousemove to different place.

Whats is more funny if target window was not active but still visible through another active but not maximized window, mouse click worked perfectly, so it seems like game read not only virtual or real mouse cursor pos but also if game window is visible.

I'm sorry I'm posting without any screenshoots or core, but my question is more like "if there are any specific rules to handle Qt5 applications?", than "help my code doesnt work".

Also if you have any mouse clicks dlls you used in other games I'd be grateful if I can test them.
No sry, but you can Try

* Click and Drop https://www.autohotkey.com/docs/command ... ckDrag.htm
* MouseClick https://www.autohotkey.com/docs/commands/MouseClick.htm
User avatar
Brazolek123
Posts: 187
Joined: 06 Jun 2016, 16:02

Re: Anyone got any experiences in posting mouse events in Qt5 apps?

17 Oct 2017, 05:35

Regular mouse clicks to active window works fine. Problems appear when it comes to the inactive one.

For example, this script:

Code: Select all

F1::
	mousegetpos, posx0, posy0
	winget,ID,hClient,A
return


F3::
	CoordMode, mouse, screen
	BlockInput, mousemove
	posx1 := posx0 + 8
	posy1 := posy0 + 8
	mousegetpos, posx2, posy2
	mousemove(posx1, posy1)
	ControlClick, x%posx1% y%posy1%, ahk_id %hClient%,,left,1,na
	sleep, 5
	mousemove(posx2, posy2)
	BlockInput, mousemoveoff
return

mousemove(posx, posy){
	global hClient
	lParam := MakeLong(posx, posy) ; will move the mouse to 5, 10
	PostMessage, 0x0200, 0, %lParam%,, ahk_id%hClient% 
}

MakeLong( LoWord, HiWord ){
 return (HiWord << 16) | (LoWord & 0xffff)
}
1) Works both active and inactive window
2) There is no 'mouse left at target pos' bug
3) It has got "only" +8 pixel offset
4) Is not reliable, works for 50% time, no matter what I'm doing with real mouse it sometimes works, sometimes not.

Edit:
fixed already. For some reason SetKeyDelay,-1 did the job.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 43 guests