View Single Post
  #8  
Old 05-06-2006, 06:03 PM
jukofyork jukofyork is offline
Senior Member
 
Join Date: Sep 2004
Location: Leeds, UK.
Posts: 2,551
Default Much safer way to send mouse-clicks...

If you check out the TableNavigator script then I just implemented a fucntion which will stop this problem 100%:

[/i]
PostLeftClick(x, y, table_id)
{ ; ### 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!!!).
Postmessage 0x201, 0x0001, ((y*65536)+x), , ahk_id%table_id%
Postmessage 0x202, 0, ((y*65536)+x), , ahk_id%table_id%
}
[/i]

About this function (see here):

[ QUOTE ]
Have now finished the Pacific support and updated the Wiki code.

To make it easier to use the PostMessage code to send mouseclicks, then I added an extra function: PostLeftClick(x, y, table_id)

It would be better in general to use this function whenever you want to send a mouse click (rather than using MouseClick AHK function) for three main reasons:

1. Like I mentioned before, it will send the click to a window which is obscured by another (ie: no problems if a window pops up infront of another at just the wrong moment) and the click will always goto the window you specified.

2. The click is sent relative to the "client rectangle" which has it's origin in the top left of the visible area of a window, but does NOT include the title bar nor left border of a window. The reason this is good, is because different Window-Management setups for windows XP use slightly different widths for their titlebars...

3. By using Postmessage, the mouse is not actually moved and the mouse click is just sent to the window's message queue (this is very like a ControlClick; where you don't see the mouse move to the control and click it, like you see happen with a MouseClick call).

The PokerStars stuff would benefit from this, but I didn't want to start changing the PokerStars MouseClick calls, as I'm not 100% sure how much needs subtracting from the coords to account for the lack of the titlebar (same goes for pretty much every other call to MouseClick in the code...).

[/ QUOTE ]

I will also try to update PartyPopupBuster application for Stars over the next few days (it should be able to block focus-stealing completely).

Juk [img]/images/graemlins/smile.gif[/img]

EDIT: If any Stars players are feeling generous/bored, then it would be appreciated if they updated the Stars-TableNavigator code to use PostLeftClick() rather than MouseClick, as I only fixed my Pacific stuff (I don't play on Stars and you need to subtract "about" 20 from the Y coords to use this function - needs a Stars player to implement/test...).
Reply With Quote