Why the results of these 2 commands may differ?
Posted: 14 Dec 2015, 06:17
Code: Select all
MouseGetPos,,, id,, 1
Code: Select all
MouseGetPos, x, y,,, 1
id := DllCall("WindowFromPoint", "Int", x, "Int", y)
Let's help each other out
https://www.autohotkey.com/boards/
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=11825
Code: Select all
MouseGetPos,,, id,, 1
Code: Select all
MouseGetPos, x, y,,, 1
id := DllCall("WindowFromPoint", "Int", x, "Int", y)
The coordinates are relative to the screen (also, just FYI: I have a single screen).I'm going to guess that it has to do with CoordMode and how the x/y coordinates get stored and that the DllCall expects them to be Screen/Absolute positions.
Code: Select all
MouseGetPos, x, y, id, control, 1
Code: Select all
MouseGetPos, x, y, id, control, 1
id_from_target := DllCall("WindowFromPoint", "Int", x, "Int", y)
Code: Select all
AHK Windows
window top-level (root) window
control child window
Code: Select all
MouseGetPos, x, y, id, control, 1
Pos := ((Y & 0xFFFFFFFF) << 32) | (X & 0xFFFFFFFF)
id_from_target := DllCall("WindowFromPoint", "Int64", Pos, "UPtr")