Home > Language Reference > Windows Management Functions > Top$

Top$

The Top$ function returns the window name of the top window.

Usage

Used to acquire dynamically the parent window name of the focused window. This window name can then be used in a UseWindow statement.  

Syntax

var$=Top$()

Parameters

None.

Return value

var$, string, name of the top window.

See also

Focus$

Examples

Shell("notepad")
a$=top$()
msgbox(a$)


'Difference between Focus$ and Top$
'Launch notepad
Shell("notepad")
'Wait until notepad window is displayed
UseWindow("NOTEPAD.EXE|Notepad|")
'Display the name of the window which is on Top
windows_name$=Top$()
Msgbox("The function Top$ returns : "+windows_name$)
Msgbox("The function Focus$ returns : "+Focus$())

 

'Close the top window in order to exit notepad
CloseWindow(top$())