I did some hunting around and found some code examples which allowed me to put together the following:
Code: Select all
ID := DllCall("GetParent", UInt,WinExist("A")), ID := !ID ? WinExist("A") : ID
;WinGetClass, Class, ahk_id %id%
;WinGetTitle, Title, ahk_id %id%
;MsgBox, %ID%
WinGetPos, X, Y, , , A ; "A" to get the active window's pos.
WinGetPos, pX, pY, , , ahk_id %ID% ; to get the parent window's pos.
MsgBox, The active window is at %X%`, %Y%`n`nThe parent window is at %pX%`, %pY%`
How can I get the coordinates of the parent window to which the active window belongs?