[Function] WinGetClientPos()

Post your working scripts, libraries and tools
dd900
Posts: 76
Joined: 27 Oct 2013, 16:03

[Function] WinGetClientPos()

01 Nov 2013, 18:11

Working example and Function

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus


I've seen other functions like this, but none ( that I found ) gave both the position and size.I was aiming for functionality similar to WinGetPos.
Last edited by dd900 on 02 Nov 2013, 20:11, edited 3 times in total.
lexikos
Posts: 6129
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: [Function] WinGetClientPos()

01 Nov 2013, 18:14

FYI, you can shorten

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

    VarSetCapacity(pos, 8)
NumPut(x, pos, 0)
NumPut(y, pos, 4)
to
dd900
Posts: 76
Joined: 27 Oct 2013, 16:03

Re: [Function] WinGetClientPos()

01 Nov 2013, 18:18

Updated function. Thank you.
just me
Posts: 5458
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [Function] WinGetClientPos()

02 Nov 2013, 04:47

You may use the address of theRECT structure retrieved by GetClientRect() directly as the second parameter of ClientToScreen(); it will only change the first two members (i.e. left & top).
Also, the DllCall() type of pointers in AHK 1.1 is "Ptr".
dd900
Posts: 76
Joined: 27 Oct 2013, 16:03

Re: [Function] WinGetClientPos()

02 Nov 2013, 09:57

Updated function. Thank you.
User avatar
Frosti
Posts: 108
Joined: 27 Oct 2017, 14:30
Facebook: They have no decency!
Google: They have no decency!
GitHub: Ixiko
Location: Somwhere between Mars and Earth
Contact:

Re: [Function] WinGetClientPos() - now with dpi correction

06 Jul 2018, 11:19

I find this function very useful and that's why I added a dpi correction.

Code: [Select all] [Expand] [Download] (WinGetClientPos_withDpiCorrection.ahk)GeSHi © Codebox Plus

burque505
Posts: 545
Joined: 22 Jan 2017, 19:37

Re: [Function] WinGetClientPos()

06 Jul 2018, 12:57

Thanks for sharing, Frosti, works great here with Win7, 64-bit, scaled to 125%
Regards,
burque505

Return to “Scripts and Functions”

Who is online

Users browsing this forum: FidoGooL and 26 guests