Tipp 0479 Laufschrift in der Titelleiste einer UserForm
Autor/Einsender:
Datum:
  Max Kaffl
02.01.2006
Entwicklungsumgebung:   Excel 2000
Um die Aufmerksamkeit des Anwenders auf eine bestimmte UserForm zu lenken, eignet sich beispielsweise eine Laufschrift in der Titelleiste. Ab Excel 2000 lässt sich dies mit einem Timer (API-Funktion) recht einfach realisieren.
Code im Codebereich des Moduls
 
Option Explicit

Private Const mcClassnameMSExcel = "XLMAIN"
Private m_strText As String

Private Declare Function KillTimer Lib "user32.dll" (ByVal hwnd _
      As Long, ByVal nIDEvent As Long) As Long

Private Declare Function SetTimer Lib "user32.dll" (ByVal hwnd _
      As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, _
      ByVal lpTimerFunc As Long) As Long

Private Declare Function FindWindow Lib "user32.dll" Alias _
      "FindWindowA" (ByVal lpClassName As String, _
      ByVal lpWindowName As String) As Long

Public Sub ShowDialogAPITimer()
  Load frmAPITimerCaption
  m_strText = frmAPITimerCaption.Caption
  frmAPITimerCaption.Show
End Sub

Public Sub prcSetTimer()
  SetTimer FindWindow(mcClassnameMSExcel, Application.Caption), _
        0&, 100&, AddressOf prcTimer
End Sub

Private Sub prcTimer(ByVal hwnd As Long, ByVal nIDEvent As Long, _
      ByVal uElapse As Long, ByVal lpTimerFunc As Long)

  m_strText = Right$(m_strText, Len(m_strText) - 1) & _
        Left$(m_strText, 1)
  frmAPITimerCaption.Caption = m_strText
End Sub

Public Sub prcKillTimer()
  KillTimer FindWindow(mcClassnameMSExcel, Application.Caption), 0&
End Sub
 
Code im Codebereich der UserForm
 
Option Explicit

Private Sub UserForm_Activate()
  Call prcSetTimer
End Sub

Private Sub UserForm_Terminate()
  Call prcKillTimer
End Sub
 
Weitere Links zum Thema
Laufschrift im Webbrowser-Control

Windows-Version
95
98
ME
NT
2000
XP
Vista
Win 7
Excel-Version
95
97
2000
2002 (XP)
2003
2007
2010


Download  (14,8 kB) Downloads bisher: [ 1344 ]

Vorheriger Tipp Zum Seitenanfang Nächster Tipp

Startseite | Projekte | Tutorials | API-Referenz | VB-/VBA-Tipps | Komponenten | Bücherecke | VB/VBA-Forum | VB.Net-Forum | DirectX-Forum | Foren-Archiv | DirectX | VB.Net-Tipps | Chat | Spielplatz | Links | Suchen | Stichwortverzeichnis | Feedback | Impressum

Seite empfehlen Bug-Report
Letzte Aktualisierung: Montag, 29. August 2011