Jump to content

ControlGetPos gives erroneous result - (Moved)


Recommended Posts

ControlGetPos gives erroneous window size (height). 

 

I use ISN AutoIT Studio V1.11, on Windows 10Home  64-bit

The code which, in my case, concentrates the problem is very simple:

$aPos =  ControlGetPos ($process_hWnd, "", "[CLASS:WindowsForms10.Window.8.app.0.141b42a_r7_ad1;INSTANCE:7]")
_DebugOut("Control 7 [" & $aPos[0] & "," & $aPos[1] & "] " & $aPos[2] & "*" & $aPos[3])
c($process_hWnd, "", "[CLASS:WindowsForms10.Window.8.app.0.141b42a_r7_ad1;INSTANCE:7]")    ; Required, unknown why
$aPos =  ControlGetPos ($process_hWnd, "", "[CLASS:WindowsForms10.Window.8.app.0.141b42a_r7_ad1;INSTANCE:7]")
_DebugOut("Control 7 [" & $aPos[0] & "," & $aPos[1] & "] " & $aPos[2] & "*" & $aPos[3])

One should bet that the two resulting output lines are the same. Wrong. This is what I get:

Control 7 [2,83] 1120*1561
Control 7 [2,83] 1126*1566

Clearly, for an unknown reason the ControlGetText statement in between influences (for me in the right way) the output of ControlGetPos. The result of the first ControlGetPos call is wrong, the result of the second call is right.

I came to this because the output of the (first) call was wrong. Then I found some code enumerating control windows and their characteristics, where the result was right for that specific control. Hence I investigated which statement would interfere somehow, an it boiled down strangely to  ControlGetText which altered the result of ControlGetPos.

 

Unfortunately I cannot investigate further to find the root cause. WHAT IS WRONG ? The call itself or its use?

 

Link to post
Share on other sites

Since nobody can run your script, I expect nobody will help you solve your issue.  I suggest you create your own GUI and try to replicate the issue.   If you still find the same behavior, then provide the complete runable code, so we can test on our side if we do have the problem.

ps. when posting code please use this tool.

Link to post
Share on other sites

Isn't there a kind of source code ControlGetPos, so I could bypass the original one on that place and investigate a little further down?

Il'' try to make it reproducible, but in the mean time the code was;

$aPos =  ControlGetPos ($process_hWnd, "", "[CLASS:WindowsForms10.Window.8.app.0.141b42a_r7_ad1;INSTANCE:7]")
_DebugOut("Control 7 [" & $aPos[0] & "," & $aPos[1] & "] " & $aPos[2] & "*" & $aPos[3])

ControlGetText($process_hWnd, "", "[CLASS:WindowsForms10.Window.8.app.0.141b42a_r7_ad1;INSTANCE:7]")    ; Required, unknown why

$aPos =  ControlGetPos ($process_hWnd, "", "[CLASS:WindowsForms10.Window.8.app.0.141b42a_r7_ad1;INSTANCE:7]")
_DebugOut("Control 7 [" & $aPos[0] & "," & $aPos[1] & "] " & $aPos[2] & "*" & $aPos[3])

The managed application window on which this code is applied is from the PDFEraser tool.

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

    No registered users viewing this page.

×
×
  • Create New...