Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Sub Timer1_Timer()
Dim TheWindows As String
TheWindows = String(100, Chr$(0))
GetWindowText GetForegroundWindow(), TheWindows, 256
Text1.Text = Text1.Text + vbCrLf + TheWindows
End Sub