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, ProcessId As Long
    
    ProcessId = Shell(CheminComplet, vbNormalFocus)
    ProcessHandle = OpenProcess(&H1F0000, 0, ProcessId)
    LanceEtAttendLaFin = WaitForSingleObject(ProcessHandle, INFINITE)
 End Function
 
Sub AttendFinDemineur()
    chemin = "C:\Program Files (x86)\Notepad++\notepad++.exe"
    If LanceEtAttendLaFin(chemin) = 0 Then
        MsgBox "coucou"
    End If
End Sub


