If found the function WinGetClientPos() here: https://www.autohotkey.com/board/topic/98679-function-wingetclientpos/
I reduced it to the following, where I simply plug in (for simplicity in testing) the target window's HWND.
Client := WinGetClientPos(5310346)
msgbox % "x" Client.X " y" Client.Y " w" Client.W " h" Client.H
return
WinGetClientPos( Hwnd ) {
VarSetCapacity( size, 16, 0 )
DllCall( "GetClientRect", UInt, Hwnd, Ptr, &size )
DllCall( "ClientToScreen", UInt, Hwnd, Ptr, &size )
x := NumGet(size, 0, "Int")
y := NumGet(size, 4, "Int")
w := NumGet( size, 8, "Int" )
h := NumGet( size, 12, "Int" )
return { X: x, Y: y, W: w, H: h }
}
Apparently, if it ever worked, it was for 32-bit AHK.
I run Win10 64 bit.
Can someone tell me how to make this work?
Getting Window Client position
Re: Getting Window Client position
Why not use the built-in WinGetClientPos?
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)
Re: Getting Window Client position
I assume this is again a v1 question posted in the wrong forum?
Btw, for code boxes I would recommend code-tags instead of c-tags, which are meant for inline code.
Btw, for code boxes I would recommend code-tags instead of c-tags, which are meant for inline code.
Re: Getting Window Client position
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)
Re: Getting Window Client position
sorry, I was just about to edit. this after I noticed that, yes, it is in the WRONG forum. It is for V1. And, V1 has no WinGetClientPos.
Re: Getting Window Client position
@iPhillip: I tried as you suggested. It didn't help. New code:
@gregster How do I use Code tags? Are they one of the icons shown when using Full editor? edit: nevermind... i hovered over the icons and found which it is.
Code: Select all
Client := WinGetClientPos(5310346)
msgbox % "x" Client.X " y" Client.Y " w" Client.W " h" Client.H
return
WinGetClientPos( Hwnd ) {
VarSetCapacity( size, 16, 0 )
DllCall( "GetClientRect", Ptr, Hwnd, Ptr, &size )
DllCall( "ClientToScreen", Ptr, Hwnd, Ptr, &size )
x := NumGet(size, 0, "Int")
y := NumGet(size, 4, "Int")
w := NumGet( size, 8, "Int" )
h := NumGet( size, 12, "Int" )
return { X: x, Y: y, W: w, H: h }
}
Re: Getting Window Client position
Okay, I moved the topic to v1 help.
You can insert code tags by using the fifth button from the left in the full editor. It either says Code or </>, depending on the used forum theme.
You can insert code tags by using the fifth button from the left in the full editor. It either says Code or </>, depending on the used forum theme.
Re: Getting Window Client position
@joefiesta, This works for me:
Code: Select all
Client := WinGetClientPos(WinExist("A"))
msgbox % "x" Client.X " y" Client.Y " w" Client.W " h" Client.H ; x0 y43 w1920 h997
return
WinGetClientPos( Hwnd ) {
VarSetCapacity( size, 16, 0 )
DllCall( "GetClientRect", Ptr, Hwnd, Ptr, &size )
DllCall( "ClientToScreen", Ptr, Hwnd, Ptr, &size )
x := NumGet(size, 0, "Int")
y := NumGet(size, 4, "Int")
w := NumGet( size, 8, "Int" )
h := NumGet( size, 12, "Int" )
return { X: x, Y: y, W: w, H: h }
}
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)
Re: Getting Window Client position
Code: Select all
Client := WinGetClientPos(5310346)
Re: Getting Window Client position
This question is resolved. Thanks all.
@iPhillip : thanks for the experimenting. I don't know what I did wrong, but you were absolutely correct. It's work fine for me now.
@ Jkust me : I realize what you said about hwnd. If you notice, I mentioned the example was just overly simplified for testing, including not getting any window but rather one that, for me, always exists.
@iPhillip : thanks for the experimenting. I don't know what I did wrong, but you were absolutely correct. It's work fine for me now.
@ Jkust me : I realize what you said about hwnd. If you notice, I mentioned the example was just overly simplified for testing, including not getting any window but rather one that, for me, always exists.
Who is online
Users browsing this forum: Bing [Bot] and 287 guests