Introduire un signalesonor qui accompagne forme.show

Fermé
zizou - 11 juil. 2013 à 11:40
michel_m Messages postés 16603 Date d'inscription lundi 12 septembre 2005 Statut Contributeur Dernière intervention 16 décembre 2023 - 11 juil. 2013 à 13:49
Bonjour, je veux quant j''introduit l'instruction form1.show sera accompagnée d'un signal
sonore ou d'une séquence audio merci



1 réponse

michel_m Messages postés 16603 Date d'inscription lundi 12 septembre 2005 Statut Contributeur Dernière intervention 16 décembre 2023 3 303
Modifié par michel_m le 11/07/2013 à 13:54
Bonjour

sons:
Private Declare Function Beep Lib "Kernel32" (ByVal Fq As Long, ByVal Tm As Long) As Long

Sub son1()
  Beep 500, 400
  Beep 700, 800
End Sub


audio (wav):
Private Declare Function PlaySound32 Lib "winmm.dll" Alias "PlaySoundA" (ByVal IpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000

' archives MPFE
Sub PlayWAV()
' snd_async: son asynchrone (la musique n'arrete pas le programme) snd_sync: arrete le prog
If Application.CanPlaySounds Then
    WAVFile = ThisWorkbook.Path & "\" & "tamusique.wav"
    Call PlaySound32(WAVFile, 0&, SND_SYNC Or SND_FILENAME)
Else
    Exit Sub
End If
End Sub


Et des paroles;
Sub lutherkingt()
Dim Sp As Object
        On Error Resume Next
    Set Sp = CreateObject("Sapi.SpVoice")
    If Sp Is Nothing Then Exit Sub
    Sp.Speak "    I have a dream today. I have a dream that one day every valley shall be exalted "
End Sub


Michel
0