GetFocus function retrieves the handle to the window that has the keyboard focus and is attached to a thread, which owns window specified by $hwnd. So if an application has 10 windows opened, and we would like to know, which one has an input focus, we call GetFocus giving it a handle of any application's windows.