Introduire un signalesonor qui accompagne forme.show

zizou -  
michel_m Messages postés 18903 Date d'inscription   Statut Contributeur Dernière intervention   -
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

  1. michel_m Messages postés 18903 Date d'inscription   Statut Contributeur Dernière intervention   3 320
     
    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