LOTUSSCRIPT LANGUAGE
GetActiveWindow returns the handle (an Integer in 16-bit Windows, a Long in 32-bit Windows) of the currently active window. GetWindowText returns the text in the window title bar.
Dim winTitle As String * 80 %If WIN16 ' 16-bit Windows Dim activeWin As Integer ' Window handles are Integer. Declare Function GetActiveWindow% Lib "User" () Declare Function GetWindowText% Lib "User" _ (ByVal hWnd%, ByVal lpstr$, ByVal i%) %ElseIf WIN32 ' 32-bit Windows Dim activeWin As Long ' Window handles are Long. Declare Function GetActiveWindow& Lib "User32" () Declare Function GetWindowText% Lib "User32" _ Alias "GetWindowTextA" _ (ByVal hWnd&, ByVal lpstr$, ByVal i&) %End If
' Print the name of the currently active window. activeWin = GetActiveWindow() ' Returns an Integer or a Long. Call GetWindowText(ActiveWin, winTitle$, 80) Print winTitle$
See Also