Code: Select all
F1::Tooltip ControlGetFocus("A")
It yields the same result by calling ControlGetFocus("ahk_exe cmd.exe").
BTW, it works fine (returning 0) with powershell.exe.
Code: Select all
F1::Tooltip ControlGetFocus("A")
Code: Select all
F1::Tooltip ControlGetFocus("A")
The target window belongs to a thread which does not have a message queue; in other words, a non-GUI thread. GetGUIThreadInfo can't be used to retrieve the focus (and other info) as it is not a GUI thread and has no focus. I suppose this is only possible for console windows, and that it would be reasonable to return 0, which is what happens when a top-level window is focused. However, it is not safe to assume that error 87 means the window is a console window.An OSError is thrown if there is a problem determining the focus.