Quote:
Originally Posted by AceofSpades
This would be great!
Yeah, I've been looking through the help files and I guess it's just a weird overlooked part of ahk to not be able to choose an x,y location and get window info assuming it's not active.
Unless there is some function to get title of window at x,y which I hadn't been able to find.
Here you go then, here is my function - took me a while to find!
Code:
WinFromPoint(x,y)
{
PX := x, PY := y
VarSetCapacity(POINT, 8, 0)
NumPut(PX, POINT), NumPut(PY, POINT, 4)
HWND := DllCall("WindowFromPoint", "Int64", NumGet(POINT, 0, "Int64"))
HWND := DllCall("GetAncestor", "UInt", HWND, "UInt", GA_ROOT := 2)
WinExist("ahk_id" . HWND)
return hwnd
}
and in use:
Code:
id := WinFromPoint(100,100)
WinGetTitle, Title, ahk_id%id%
WinGetClass, Class, ahk_id%id%
WinGetPos, X, Y, W, H, ahk_id%id%
MsgBox, %id% - %Title% - %Class% - %X%,%Y%,%W%,%H%