Edited: I forgot to mention that in my script I already use OnMouseMove for other purpose, so I prefer a solution which works inside OnMouseMove.
Code: Select all
Gui Test: +HwndIdTest -dpiScale
Gui Test: Show, x50 y50 w800 h500
OnMessage(0x200, "OnMouseMove")
Return
OnMouseMove()
{
Global IdTest
MouseGetPos mx, my, IdWindow
WinGetTitle, WinT, ahk_id %IdWindow%
ToolTip The cursor is in window %WinT%, 150, 3
If (IdWindow != IdTest) ; Doesn't work,
MsgBox Out! Now in %WinT%! ; of course.
}
TestGuiClose:
ExitApp