Visual-Basic Tipps, Tricks, Test und Meinungen!


Apple-Hardware Digital-Foto Digital-Video Elektronik Notebook PC-Hardware PC-Kauftipps PC-Tuning Linux System Netzwerke Novell Windows 2000 Windows 95 Windows 98 Windows ME Windows NT Windows Vista Windows XP Access Apple-Software Backoffice CAD/CAM Corel Excel Linux Lotus PC-Grafik PC-Software Photoshop Powerpoint SQL Star-Office Word ASP C (K&R) C# -.Net C++ Delphi Dreamwaver Flash HTML/CSS Internet Java JavaScript PHP Perl Visual-Basic Webdesign XML Handy / Co. Klassik Computer PC-Allgemein Pocket-PC Sicherheit/Viren Onlinegaming PC-Games Spielekonsolen IE / Outlook NN / Mozilla Opera Fitness Gesundheit Mountainbike Car-HiFi Kfz-Allgemein Kfz-Tuning Motorrad Bücher Haustiere Heimwerken Job Musik Musikprod. Reisen Studium TV / Kino Unterhaltungselektronik
Google-Anzeigen


Hilfe zum Thema: Visual-Basic, Setwindowtext, Vb6, Api
Re: so gehts

Du kannst einen API-Timer starten und dann im Timer-Event die Msgbox suchen und den WindowText der Buttons ändern.
Ein VB-Timer funktioniert hier nicht weil das VB-Timerevent von der MsgBox blockiert wird, die API-Timerfunktion hingegen wird aufgerufen.
Aufruf der Msgbox

Private Sub Command1_Click()
   StartTimer 1
   MsgBox "Ja Nein Abbrechen", vbYesNoCancel, "MsgBox"
End Sub

Wegen dem Callback beim Timer muß das in ein Modul

Option Explicit
Private Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As StringByVal lpWindowName As StringAs Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As LongByVal wCmd As LongAs Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As LongByVal lpClassName As StringByVal nMaxCount As LongAs Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As LongAs Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As LongByVal lpString As StringByVal cch As LongAs Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As LongByVal lpString As StringAs Long
Private Declare Function SetTimer Lib "user32" (ByVal hwnd As LongByVal nIDEvent As LongByVal uElapse As LongByVal lpTimerFunc As LongAs Long
Private Declare Function KillTimer Lib "user32" (ByVal hwnd As LongByVal nIDEvent As LongAs Long
Private MtmrID As Long
Public Sub StartTimer(ByVal intMilliSeconds As Integer)
   MtmrID = SetTimer(0, 0, intMilliSeconds, AddressOf CallBackTimerProc)
End Sub
Public Sub StopTimer()
   If MtmrID <> 0 Then
      KillTimer 0, MtmrID
   End If
End Sub
Public Sub CallBackTimerProc(ByVal hwnd As LongByVal uMsg As LongByVal idEvent As LongByVal dwTime As Long)
Dim hwndDialog As Long
Dim hwndButton As Long
   StopTimer
   hwndDialog = FindWindow("#32770""MsgBox")  '// <-- Titel der Msgbox angeben
   If hwndDialog > 0 Then
      hwndButton = GetWindow(hwndDialog, GW_CHILD)
      Do While hwndButton > 0
         If ClassName(hwndButton) = "Button" Then
            Select Case WindowText(hwndButton)
               Case "&Ja"
                  SetWindowText hwndButton, "super"
               Case "&Nein"
                  SetWindowText hwndButton, "nee du"
               Case "Abbrechen"
                  SetWindowText hwndButton, "vielleicht"
            End Select
         End If
         hwndButton = GetWindow(hwndButton, GW_HWNDNEXT)
      Loop
   End If
End Sub
Private Function ClassName(ByVal hwndWindow) As String
Dim lngLen As Long
Dim strText As String
   strText = Space(256)
   lngLen = GetClassName(hwndWindow, strText, Len(strText))
   ClassName = Left$(strText, lngLen)
End Function
Private Function WindowText(ByVal hwndWindow As LongAs String
Dim strText As String
Dim lngLen As Long
   strText = Space(GetWindowTextLength(hwndWindow) + 1)
   lngLen = GetWindowText(hwndWindow, strText, Len(strText))
   WindowText = Left$(strText, lngLen)
End Function


Google-Anzeigen


Weitere Informationen zu diesen Themen:   Api  
Geschickt von Gaga, Mi 30.04.2008 9:20

Google-Anzeigen


Warum immer zahlen? Einfach kostenlose Software downloaden:
Kostenlose
Spiele

Kostenlos spielen!
Kostenlose
Fotosoftware

Kostenlose Fotosoftware!
Kostenlose
Terminplaner

Kostenlose Terminplaner!
Kostenlose
3D Simulatoren

Kostenlose 3D-Simulatoren!
Kostenlose
PC-Tools

Kostenlose PC-Utilities!
Kostenlose
Brettspiele

Kostenlose Brettspiele!
Kostenlose
MP3 Tools

Kostenlose MP3-Tools!

Kostenlose Android Apps für Tablet PCs wie dem Galaxy Tab und Xoom
Free android tablet app downloads: Games, Security, Antivirus, Filemanager for your Tab.
Kostenlose Software-Grundausstattung für Windows-PCs Kostenlose Software-Vollausstattung für Windows-PCs
Kostenlos spielen - Spiele Downloads ohne Limits

cs
es
fr
it
no
pl
pt
tl
tr
ru

Spotlight.de distanziert sich ausdrücklich von im Forum eingestellten Fremdinhalten jeglicher Art.


Kostenlose
Antiviren-
software!
Kostenlose Antivirensoftware!


Kostenlose
Spiele!
Kostenlose Spiele!


Android
Apps für
Tablet-PCs!
Andriod Tablet Apps z. B. für Samsung Galaxy Tab


Kostenlose
3D-
Simulatoren!
Kostenlose 3D-Simulatoren!


Kostenlose
PC-Utilities!
Kostenlose PC-Utilities!


Kostenlose
Terminplaner!
Kostenlose Terminplaner!


Kostenlose
Grafik-
software!
Kostenlose Grafiksoftware!