GetClientRect equivalent Topic is solved

Propose new features and changes
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

GetClientRect equivalent

Post by evilC » 23 Jul 2016, 14:13

Could we maybe add something to AHK which wraps GetClientRect and pulls the values from the struct?

Currently, you need to use DllCall to get the client rect of a non-AHK window.

Jnizm has a function here, but I feel this should be built into AHK and it seems like it would be technically trivial.

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: GetClientRect equivalent

Post by HotKeyIt » 23 Jul 2016, 14:32

In AutoHotkey_H you can:

Code: Select all

Gui, Show, W200 H200
Gui, +LastFound
; Get some window. In this case, the GUI we just created.
hwnd := WinExist()

; Retrieve the width (w) and height (h) of the client area.
GetClientRect(hwnd,(rc:=Struct("Int left,top,right,bottom"))[])
MsgBox % "Width = " rc.right " Height = " rc.bottom
ExitApp

User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: GetClientRect equivalent

Post by evilC » 23 Jul 2016, 14:42

Yeah, but even that is a bit much for your average newbie to wrap their head around.
You should be able to to it using the same kind of syntax that you would with WinGetPos

lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: GetClientRect equivalent

Post by lexikos » 23 Jul 2016, 17:48

It's already on one of my TODO lists. I have a few of those...

lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: GetClientRect equivalent  Topic is solved

Post by lexikos » 02 Dec 2022, 21:10

WinGetClientPos was added in v2.0-a084, and is not planned for v1. There is also Gui.GetClientPos() in v2.0-a111+.

Post Reply

Return to “Wish List”