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 28
|
Option Compare Database
Option Explicit
'========================
'Cette section doit être dans le HAUT d'un module standard.
'C'est la déclaration des API
Declare Function WaitForSingleObject Lib "Kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Declare Function OpenProcess Lib "Kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Const INFINITE = &HFFFF
Function LanceEtAttendLaFin(ByVal CheminComplet As String) As Long
Dim ProcessHandle As Long
Dim ProcessId As Long, ret&
ProcessId = Shell(CheminComplet, vbNormalFocus)
ProcessHandle = OpenProcess(&H1F0000, 0, ProcessId)
LanceEtAttendLaFin = WaitForSingleObject(ProcessHandle, INFINITE)
End Function
Function WaitForEnd(Fichier) As Long
Dim wsh As Object
Set wsh = CreateObject("WScript.Shell")
WaitForEnd = wsh.Run(Fichier, 1, True)
End Function |
Partager