Retrieves which control of the target window has input focus, if any.
ClassNN := ControlGetFocus(WinTitle, WinText, ExcludeTitle, ExcludeText)
A window title or other criteria identifying the target window. See WinTitle.
If present, this parameter must be a substring from a single text element of the target window (as revealed by the included Window Spy utility). Hidden text elements are detected if DetectHiddenText is ON.
Windows whose titles include this value will not be considered.
Windows whose text include this value will not be considered.
Returns the ClassNN of the control; that is, the control's classname followed by its sequence number within its parent window, e.g. Button12.
If there was a problem or none of the target window's controls has focus, the return value is blank.
ErrorLevel is set to 1 if there was a problem determining the focus or 0 otherwise. An ErrorLevel of 1 typically indicates that the window does not exist.
The control retrieved by this function is the one that has keyboard focus, that is, the one that would receive keystrokes if the user were to type any.
The target window must be active to have a focused control, but even the active window may lack a focused control. If the target window was found but none of its controls have focus, ErrorLevel is set to 0 and the return value is blank.
Window titles and text are case sensitive. Hidden windows are not detected unless DetectHiddenWindows has been turned on.
ControlFocus, ControlMove, ControlClick, ControlGetText, ControlSetText, ControlSend
Focused := ControlGetFocus("Untitled - Notepad") if ErrorLevel MsgBox "The target window doesn't exist." else MsgBox "Control with focus = " Focused