choupiz
Messages postés1Date d'inscriptionmardi 21 juin 2005StatutMembreDernière intervention22 juin 2005
-
22 juin 2005 à 08:22
BruNews
Messages postés21040Date d'inscriptionjeudi 23 janvier 2003StatutModérateurDernière intervention21 août 2019
-
22 juin 2005 à 11:43
Bonjour. J'ai un programme qui est sensé appeler une application et attendre que cette application se termine avant de continuer a tourner. Ca fonctionne tres bien sous NT et 2000 mais ça marche pas quand je veux le mettre sous XP. Voilà le bout de programme concerné si queulqu'un a une idée...
Le code a été récupéré sur ce site.
Merci d'avance
Public Declare Function WinExec Lib "kernel32" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As Long
Public Const PROCESS_QUERY_INFORMATION = &H400
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Function ExecCmd(cmdline$)
Dim reponse As Integer
Dim reponse2 As Long
If reponse > 0 Then
' Boucle d'attente de la fin d'exécution
Do
reponse2 = OpenProcess(PROCESS_QUERY_INFORMATION, False, reponse)
Debug.Print reponse2
Loop While (reponse2 <> 0)
End If
End Function
j621473
Messages postés14Date d'inscriptionmercredi 9 mars 2005StatutMembreDernière intervention26 juillet 2007 22 juin 2005 à 08:42
Hello
Je suis novice en la matière mais j'utilise ShellWait et ca marche plutot bien
voici :
'Fonction privé qui fonctionne uniquement sur cette feuille
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Sub ShellWait(ByVal JobToDo As String)
Dim hProcess As Long, retval As Long
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, Shell(JobToDo, vbMinimizedNoFocus))
Do
GetExitCodeProcess hProcess, retval
DoEvents
Sleep 100
Loop While retval = STILL_ACTIVE
End Sub
Private Sub Form_Load()
ShellWait "regedit /s " & GetShortPath("C:\Program Files") & "\XELEC\PCI\xelec_var.reg"
End Sub