Jump to content

Calculate Mouse Position from ControlClick Coords


Recommended Posts

Hi,

My application only responds to MouseClick, but not ControlClick (I tried all the controlenable, focus, etc.). That's why I'd like to calculate Mouse Position from ControlClick Coords.

I tried:

window position + control position + ControlClick Coords

but they don't add up to Mouse position.

anyone has any idea? Thanks.

>>>> Window <<<<

Title: application

Class: ThunderRT6MDIForm

Position: 0, 0

Size: 1024, 256

Style: 0x16CF0000

ExStyle: 0x00040100

Handle: 0x00090606

>>>> Control <<<<

Class: TreeView20WndClass

Instance: 1

ClassnameNN: TreeView20WndClass1

Advanced (Class): [CLASS:TreeView20WndClass; INSTANCE:1]

ID:

Text:

Position: 6, 58

Size: 125, 638

ControlClick Coords: 61, 57

Style: 0x56000203

ExStyle: 0x00000200

Handle: 0x001409FE

>>>> Mouse <<<<

Position: 71, 157

Cursor ID: 0

Color: 0xFFFFFF

>>>> StatusBar <<<<

Link to comment
Share on other sites

opt("MouseCoordMode",1)

#include <GUIConstants.au3>


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 625, 445, 193, 125)
$Button1 = GUICtrlCreateButton("Button1", 208, 112, 137, 65, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


sleep(5000)

$pos=ControlGetPos("Form1","",$Button1)


$win=WinGetPos("Form1")

MouseClick("left",$win[0]+$pos[0]+($pos[2]/2),$win[1]+$pos[1]+($pos[3]/2)+10,1)

sleep(5000)
Exit

this probably isnt what you want, but...... well ..... worth a try

Edited by Aceguy
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...