1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Dim aRetVal As Long
Dim i As Long, j As Long
Dim hndApi As Long
Dim ret1 As Long, ret2 As Long
Dim start As Long
aRetVal = ShellExecute(Me.hWnd, "open", "CheminAppli/nomAppli.exe", "", "", 1)
i = 0
start = Timer
'sans la boucle, le findWindow s'effectue avant que l'appli soit vraiment lancée
Do
i = FindWindow("RBWindow", "Titre exact appli")
Loop While (i = 0 And (Timer < start + 1))
Debug.Print "i=" & i 'j'obtiens le bon handle de fenetre
i = 0
start = Timer
Do
j = FindWindowEx(i, ByVal 0&, "RB_Pane", "")
Loop While (j = 0 And (Timer < start + 1))
Debug.Print "j=" & j 'j'obtiens le bon handle de bouton (qui n'a pas de caption)
ret1 = SetActiveWindow(i)
ret1 = SetForegroundWindow(i)
Call SendMessage(j, BM_CLICK, 0, 0) |
Partager