·  Start ·  Programme ·  Codes ·  Tipps ·  ActiveX ·  Tutorials · 



Sie brauchen für diesen Tipp eine Userform, einen Label (Label1) und einen Timer (Timer1). Sobald ein Fenster den Fokus bekommt (aktiv wird), ändert sich die Anzeige im Label.

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 Form_Load()
    Timer1.Interval = 100
End Sub 

Private Sub Timer1_Timer()
    Static lHwnd As Long 
    Dim lCurHwnd As Long 
    Dim sText As String * 255
 
    lCurHwnd = GetForegroundWindow
    If lCurHwnd = lHwnd Then Exit Sub 
    lHwnd = lCurHwnd
    If lHwnd <> hwnd Then 
        Label1.Caption = "Aktives Fenster: " & Left$(sText, _
        GetWindowText(lHwnd, ByVal sText, 255))
 
    Else 
        Label1.Caption = "Aktives Fenster: Form1"
    End If 
 
End Sub 
Aktualisiert: 12.02.2008, 14:10 Uhr Copyright © 2001 - 2010 by ST-software Navigation zurück  |  Navigation vorwärts  |  Zum Seitenanfang     
Ihre IP: 38.107.191.83 ·  Seite erstellt in: 0.063 Sekunden ·  Dateigröße:  2857 Bytes