Jump to content

controlgetpos and true position within an app - problem


Go to solution Solved by jguinch,

Recommended Posts

Posted

When using ControlGetPos to determine control location in app window - I'm getting coordinates, that start not from the external borders of an app, but from internal guts. Which means, that header (the thing with app name) and left border is excluded.

This generates certain problem, because from what I can say - win8 and win7 have different container layouts. So my question. How to get control position in relation to complete gui of the app, or just absolute coordinates?

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

Posted

It looks that after weekend forum update, my post disappeared.

The problem is, that this internal window of the app has it's own screen handles, so there is no way to use ControlClick on them. The only way is to use regular screen clicking and dragging. If I run the script on different win7/8 machine/layout, then everything is shifted, and the mouse no longer hits the item area. Header and border sizes also change when using windowed/maximized mode. So I need to get the position of a subwindow in relation to (0,0) coordinates of the screen or of the outer borderline of win aplication. Having true location (and size) of that control - I can scale parameters to hit proper positions.
 

I'm designing test scenarios, why the question?

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

Posted

I have no idea how to achieve it. Some example would be helpful.

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

  • Solution
Posted

You can use WinGetPos with a control handle, so you will have its position/dimensions relative to the screen :

Run("notepad.exe")

$hWnd = WinWait("[CLASS:Notepad]")
$hEdit = ControlGetHandle($hWnd, "", "[CLASS:Edit; INSTANCE:1]")

$aEditPos = WinGetPos($hEdit)
ConsoleWrite("LEFT   : " & $aEditPos[0] & @CRLF & _
             "TOP    : " & $aEditPos[1] & @CRLF & _
             "WIDTH  : " & $aEditPos[2] & @CRLF & _
             "HEIGHT : " & $aEditPos[3] & @CRLF )
Posted

Thanks, this should work. I just found on google and tested similar thing.

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

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
  • Recently Browsing   0 members

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