Salut tout le monde,

Avant, sous windows XP, mes applications lançaient un message sonore sans aucun problème et l'application s'arrêtait tant que le message n'était terminé.
Voici les fonctions que j'utilise :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
29
30
 
Function MessageSonore(P_Fichier_wav)
    Application.ScreenUpdating = False
 
    WFichier_txt = G_DOSSIER_SPEECH & "\" & P_Fichier_wav
    If Test_Fichier("C:\windows\system32\sndrec32.exe", False) = True Then ' Windows XP
        If Test_Fichier(WFichier_txt, False) = True Then
            ShellWait "sndrec32 /play /Close " & WFichier_txt
        Else
            ShellWait "sndrec32 /play /Close " & G_DOSSIER_SPEECH & "\" & "message_sonore_inexistant.wav"
        End If
    Else 'Windows SEVEN
        If Test_Fichier(WFichier_txt, False) = True Then
            mciExecute ("play " & WFichier_txt)
        Else
            mciExecute ("play " & G_DOSSIER_SPEECH & "\" & "message_sonore_inexistant.wav")
        End If
    End If
End Function
 
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 10
    Loop While RetVal = STILL_ACTIVE
End Sub
Maintenant, sous SEVEN, je n'arrive pas à ce que l'application s'arrête le temps du message sonore.
Merci d'avance pour votre aide.