Jump to content

Detect window under mousecursor


 Share

Recommended Posts

Hey guys,

have been searching the forum for a while now and found some stuff about getting the control under the mousecursor.

I just need to get the Windowtitle under the mousecursor when I call a function.

I'm writing a betpot script for Ongame (Pokerroom). Right now I click the window where I want to bet the pot and just use WinGetTitle("", ""), but the focus of the window is stolen if another window needs attention and this happens quite often when 12-tabling. So I want to start the BetPot function with some lines of code that get the window under the mousecursor.

Link to comment
Share on other sites

Try this:

$aMousePos = MouseGetPos()

$aWinList = WinList()

For $i = 1 To $aWinList[0][0]
    $aWinPos = WinGetPos($aWinList[$i][1])
    If ($aMousePos[0] >= $aWinPos[0]) And ($aMousePos[0] <= $aWinPos[0] + $aWinPos[2]) _
    And ($aMousePos[1] >= $aWinPos[1]) And ($aMousePos[1] <= $aWinPos[1] + $aWinPos[3]) Then
        MsgBox(0, "", $aWinList[$i][0])
        ExitLoop
    EndIf
Next
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...