How to get window client area pos? (x y width height)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User
Posts: 407
Joined: 26 Jun 2017, 08:12

How to get window client area pos? (x y width height)

11 Jan 2019, 18:09

How to get window client area pos? (x y width height)

Thanks!
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to get window client area pos? (x y width height)

11 Jan 2019, 18:33

WinGetClientPos. Cheers.
commands as functions (AHK v2 functions for AHK v1) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 37&t=29689
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: How to get window client area pos? (x y width height)

11 Jan 2019, 19:39

jeeswg wrote:
11 Jan 2019, 18:33

Thanks @jeeswg! Does it work with AHK 64 bit?

Code: Select all

	;from WinGetClientPos() - "jeeswg" forum user
	;https://www.autohotkey.com/boards/viewtopic.php?p=209004#p209004

gui, +HwndWinId

gui, show, w300 h200

WinGetPos, Win_X, Win_Y, Win_W, Win_H, % "ahk_id" WinId

VarSetCapacity(RECT, 16, 0)
DllCall("user32\GetClientRect", Ptr,WinId, Ptr,&RECT)
DllCall("user32\ClientToScreen", Ptr,WinId, Ptr,&RECT)
Win_Client_X := NumGet(&RECT, 0, "Int")
Win_Client_Y := NumGet(&RECT, 4, "Int")
Win_Client_W := NumGet(&RECT, 8, "Int")
Win_Client_H := NumGet(&RECT, 12, "Int")

msgbox, % ""
. Win_X " - " Win_y " - " Win_w " - " Win_h    "`r`n"
. "`r`n"
. Win_Client_X " - " Win_Client_y " - " Win_Client_w " - " Win_Client_h    "`r`n"

return

guiclose:	;____________________
exitapp
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to get window client area pos? (x y width height)

11 Jan 2019, 19:58

- Every script I write should work in both x64 and x32, otherwise there would be a bug of some kind.
- I tested the function just now and it worked in both.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: How to get window client area pos? (x y width height)

11 Jan 2019, 20:40

jeeswg wrote:
11 Jan 2019, 19:58
- Every script I write should work in both x64 and x32, otherwise there would be a bug of some kind.
- I tested the function just now and it worked in both.
Thanks again @jeeswg! Keep the good and hard work! (I wish you all the best in 2019!)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Kintaro-OEx, peter_ahk and 368 guests