Retrieves which control of the target window has keyboard focus, if any.
HWND := ControlGetFocus(WinTitle, WinText, ExcludeTitle, ExcludeText)
Type: String, Integer or Object
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.
This function returns the window handle (HWND) of the focused control.
If none of the target window's controls has focus, the return value is 0.
A TargetError is thrown if there is a problem determining the target window or control.
An OSError is thrown if there is a problem determining the focus.
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.
Window titles and text are case sensitive. Hidden windows are not detected unless DetectHiddenWindows has been turned on.
ControlFocus, Control functions