GetFocusWindowHandle

Windows management function.

The GetFocusWindowHandle function returns the handle of the window which has focus; this handle can then be used in Windows API functions or with UseWindowHandle (gives title independence).

Syntax

handle=GetFocusWindowHandle()

Parameters

None

Return value

handle : integer, handle of the window which has the focus.

See also

GetTopWindowHandle, UseWindowHandle, GetWindowName$

Example

 

shell("wordpad.exe")

pause 2
a=GetFocusWindowhandle()

msgbox(a)
UseWindowHandle(a)
SendKeys("Hello")

a returns WordPad window's handle and this handle can be used in UseWindowHandle and then SendKeys sends the specifed keys to that handled window.