WinActivate does not guarantee bringing the window foremost, it just guarantees that the window is 'active' and therefore focused (I guess for keyboard input)WinActivate
Activates the specified window (makes it foremost).
test script:
Code: Select all
f6::
MouseGetPos,,,mhwnd
WinSet, bottom,, ahk_id %mhwnd%
return
f7::
MouseGetPos,,,mhwnd
WinActivate, ahk_id %mhwnd%
return
f8::
MouseGetPos,,,mhwnd
DllCall("SetForegroundWindow", "uInt", mhwnd)
return
f9::
MouseGetPos,,,mhwnd
MsgBox, % DllCall("SetForegroundWindow", "uInt", mhwnd)
return
f10::
MouseGetPos,,,mhwnd
DllCall("BringWindowToTop", "uInt", mhwnd)
return
open notepad. click it to activate it. mouseover and press F6 to send it to bottom. the window is now at bottom, but its still 'active' according to windows and will still accepts keyboard input. if you mouseover again and press F7, the window will not be brought to the foreground.
F8 fails too. yet somehow F9 works. F10 seems to always work
so either a bug in the sense that its not doing what is documented, or the documentation is incorrect