ERFORDERLICHE
OBJEKTE
1 Label (Label1)
1 Timer (Timer1)
FORM-CODE
Private Declare Function GetWindowText Lib "user32" Alias _
"GetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetForegroundWindow Lib _
"user32" () As Long
Private Sub Form_Load()
Timer1.Interval = 200
End Sub
Private Sub Timer1_Timer()
Dim hWn As Long
Dim Titel As String * 255
Titel = String$(255, 0)
hWn = GetForegroundWindow
GetWindowText hWn, Titel, 255
pos = InStr(Titel, Chr$(0))
If pos > 0 Then Titel = Left$(Titel, pos - 1)
Label1.Caption = Trim(Titel)
End Sub
|