WinGetClientPos and Window Spy Topic is solved

Discuss the future of the AutoHotkey language
User avatar
jeeswg
Posts: 4479
Joined: 19 Dec 2016, 01:58
Location: UK

WinGetClientPos and Window Spy

10 Feb 2018, 06:25

- AHK v2's WinGetClientPos function, and Window Spy (WindowSpy.ahk), are showing different values for the active window's client position.
- The WinGetClientPos function shows what I believe to be the correct X/Y values.
- Window Spy shows what I believe to be the correct width/height values.
- I provide a custom function below which I believe shows all of the correct values.
- Note: Window Spy does not show any X/Y values for the active window's client position, there is a gap where it could be added, and I believe it would only take about 2 changes to the code, to add it in.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Helgef
Posts: 2988
Joined: 17 Jul 2016, 01:02
Contact:

Re: WinGetClientPos and Window Spy

10 Feb 2018, 13:41

As far as I can tell, WinGetClientPos isn't documented. It gives you the coordinates of the upper left corner of the client area, and the coordinates of the lower right corner (in screen coords). Example,

Code: [Select all] [Download] GeSHi © Codebox Plus

q:: ;)
winGetClientPos(x1,y1,x2,y2,"A")
msgbox "w: " x2-x1 "`th: " y2-y1
return

Cheers.
User avatar
jeeswg
Posts: 4479
Joined: 19 Dec 2016, 01:58
Location: UK

Re: WinGetClientPos and Window Spy

10 Feb 2018, 18:07

Great, thanks so much Helgef. I trusted that there might be a reasonable explanation, but I just wasn't expecting XYRB (aka TLRB) instead of XYWH. A fix for my code above:

Code: [Select all] [Download] GeSHi © Codebox Plus

;note: 'client pos'
WinGetClientPos(vWinX, vWinY, vWinR, vWinB, "A")
vWinW := vWinR-vWinX, vWinH := vWinB-vWinY
vCoords1 := Format("x{} y{} w{} h{}", vWinX, vWinY, vWinW, vWinH)
lexikos
Posts: 5933
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: WinGetClientPos and Window Spy  Topic is solved

10 Feb 2018, 21:39

Helgef wrote:As far as I can tell, WinGetClientPos isn't documented.
Oops.
It gives you [...] the coordinates of the lower right corner (in screen coords).
Double oops. It's not supposed to do that.

Edit: Fixed in v2.0-a089.

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 5 guests