TopInstance
Windows management function.
The TopInstance function returns the instance number of the main window which has the focus.
Syntax
instance_num=TopInstance()
Return value
instance_num, numeric. Gives the instance number of the main window which has the focus (the name of that window can be found using Top$ function).
Example
UseWindow("NOTEPAD.EXE|Edit|Untitled - Notepad|1",1)
SendKeys("Hello<Enter>")
a=TopInstance()
msgbox(str$(a))