Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Internet Gambling > Software
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-17-2007, 05:32 PM
Surf Surf is offline
Senior Member
 
Join Date: Apr 2004
Location: Blogging
Posts: 5,619
Default Re: prevent focus stealing in Vista? messing up my AHK script

I found a decent workaround in case anyone has the same problem. When I first register a button click on a table i use MouseGetPos,,tableId to retrieve the ID # of the table under the cursor. Then, before I send a command like ControlClick or whatnot, I first use WinActivate, %tableId% to activate the table that was under the mousepointer when the click initially happened.

It's still possible that another table will steal focus in between the time the table is activated and the time the click is sent (in between 2 lines of code) but it is extremely unlikely.

Surf
Reply With Quote
  #2  
Old 11-17-2007, 07:03 PM
jukofyork jukofyork is offline
Senior Member
 
Join Date: Sep 2004
Location: Leeds, UK.
Posts: 2,551
Default Re: prevent focus stealing in Vista? messing up my AHK script

[ QUOTE ]
I found a decent workaround in case anyone has the same problem. When I first register a button click on a table i use MouseGetPos,,tableId to retrieve the ID # of the table under the cursor. Then, before I send a command like ControlClick or whatnot, I first use WinActivate, %tableId% to activate the table that was under the mousepointer when the click initially happened.

It's still possible that another table will steal focus in between the time the table is activated and the time the click is sent (in between 2 lines of code) but it is extremely unlikely.

[/ QUOTE ]
Have you tried to use my PostLeftClick() function. It posts a mouse click into the window's message queue which means it can't mess up and click in the wrong window:

<font class="small">Code:</font><hr /><pre>
PostLeftClick(x, y, table_id, activate=1) {
; ### JUK: Send the down left click, then the mouse-up messages.
; NOTE: This is relative to the top left of the client area and NOT the top left of the
; window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
WinActivate, ahk_id%table_id%
PostMessage, 0x201, 0x0001, ((y&lt;&lt;16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y&lt;&lt;16)^x), , ahk_id%table_id%
}
</pre><hr />

Juk [img]/images/graemlins/smile.gif[/img]
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:40 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.