Comment savoir si une fenêtre qu'on a ouverte s'est terminée

Adrien - 13 juin 2000 à 18:24
 jazzyj - 15 juin 2000 à 13:24
Je lance une fenêtre via un shell mais je ne sais pas détecter quand elle se ferme

Merci de me donner un coup de main

1 réponse

va chez microsoft et cherche l api CreateProcessA
ta fenetre shell doit se lancer viale parametre cmdline$
non seulement ton appli attendra que ta fenetre termine son process avant de poursuivre mais en plus tu sais quand ta fenetre se ferme puisse que il y a passage a la lige suivante
les users type PROCESS_INFORMATION et start.. sont détaillé chez microsoft. ici ce serait trop long sinon pour plus d info jazzyj@ibelgique.com

Public Sub ExecCmd(cmdline$)
'tjs pour cptlink
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ret&
Form1.PBar.Value = 9
'Initialize the STARTUPINFO structure:
start.cb = Len(start)

'Start the shelled application:
ChDrive Left$(cmdline, 2) '"h:"
ChDir CompletePath '& "\cubic" '"h:\cubic" '

ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
'MsgBox "Before WaitForSingleObject"
'Wait for the shelled application to finish:
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
'MsgBox "After WaitForSingleObject"
ret& = CloseHandle(proc.hProcess)
Form1.PBar.Value = 10
End Sub
0
Rejoignez-nous