Fermer un message

ecarlate Messages postés 9 Date d'inscription jeudi 30 décembre 2004 Statut Membre Dernière intervention 28 janvier 2005 - 18 janv. 2005 à 15:01
cs_Douns Messages postés 100 Date d'inscription lundi 16 septembre 2002 Statut Membre Dernière intervention 19 septembre 2005 - 18 janv. 2005 à 15:36
Bonjour a tous,
Voila j ai créer un petit programme qui installe automatiquement des logiciels au debut j avais intégrer le sp3 de office xp dans l office mais cela ne convient pas j ai donc choisi de l installer a la suite de office mais probleme la mise a jour affiche un message "l'installation c'est bien terminer" et je voudrais donc que dès que ce message apparait mon programme le ferme
merci d avance de votre aide

1 réponse

cs_Douns Messages postés 100 Date d'inscription lundi 16 septembre 2002 Statut Membre Dernière intervention 19 septembre 2005 1
18 janv. 2005 à 15:36
Bon voici une solution, il y a peut-etre plus simple :

Il faut que tu mettes un timer appelé timer1

'déclaration des appels aux api
Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long

Private Sub Form_Load()
'on initialise l'intreval a toutes les seconde et en fonctionnement
Timer1.Interval = "1000"
Timer1.enabled=true
End Sub

Private Sub Timer1_Timer()
dim hwnd as long
'récupere le processus de la fenetre active
hwnd = GetForegroundWindow
if GetCaption(hwnd)=" titre de ta message box " then
'on simule l'appuie d ela touche entrée
SendKeys ENTER
end if
End Sub

'function pour récupérer le titre
Function GetCaption(hwnd As Long)
Dim hWndTitle As String
hWndlength = GetWindowTextLength(hwnd)
hWndTitle = String(hWndlength, 0)
GetWindowText hwnd, hWndTitle, (hWndlength + 1)
GetCaption = hWndTitle
End Function
0
Rejoignez-nous