Alarme sonore

vinsus51 Messages postés 39 Date d'inscription vendredi 30 avril 2004 Statut Membre Dernière intervention 7 juin 2013 - 5 mai 2004 à 12:03
pcpunch Messages postés 1243 Date d'inscription mardi 7 mai 2002 Statut Membre Dernière intervention 18 février 2019 - 5 mai 2004 à 15:12
je souhaite q'un bouton declenche une alarme sonore et qu'un autre l'arrete cela parrait simple mais je n'y arrive point .

Alarme autre que beep quelque chose e plus puissant

Merci de votre aide

Vinsus (debutant)

Vinsus (b)

3 réponses

pcpunch Messages postés 1243 Date d'inscription mardi 7 mai 2002 Statut Membre Dernière intervention 18 février 2019 5
5 mai 2004 à 12:13
ben joue un wav en boucle avec l'api playsound!!!
++
0
vinsus51 Messages postés 39 Date d'inscription vendredi 30 avril 2004 Statut Membre Dernière intervention 7 juin 2013
5 mai 2004 à 13:55
Merci de m'aider mai justement je croi que c avec l'api que je galere un peu pourrait tu me donner un exemple stp merci d'avance

Vinsus (tres debutant!!)
0
pcpunch Messages postés 1243 Date d'inscription mardi 7 mai 2002 Statut Membre Dernière intervention 18 février 2019 5
5 mai 2004 à 15:12
Voila une exemple avec l api Beep qui permet de jouer un son par le speaker en choisissant sa freqence :

Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

Private Sub Form_Activate()
    Dim Cnt As Long
    For Cnt = 0 To 5000 Step 10
        'play a tone of 'Cnt' hertz, for 50 milliseconds
        Beep Cnt, 50
        Me.Caption = Cnt
        DoEvents
    Next Cnt
End Sub


Voila un exemple avec l'api Playsound :
Private Const SND_APPLICATION = &H80 ' look for application specific association
Private Const SND_ALIAS = &H10000 ' name is a WIN.INI [sounds] entry
Private Const SND_ALIAS_ID = &H110000 ' name is a WIN.INI [sounds] entry identifier
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_FILENAME = &H20000 ' name is a file name
Private Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Private Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file
Private Const SND_NODEFAULT = &H2 ' silence not default, if sound not found
Private Const SND_NOSTOP = &H10 ' don't stop any currently playing sound
Private Const SND_NOWAIT = &H2000 ' don't wait if the driver is busy
Private Const SND_PURGE = &H40 ' purge non-static events for task
Private Const SND_RESOURCE = &H40004 ' name is a resource name or atom
Private Const SND_SYNC = &H0 ' play synchronously (default)
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

Private Sub Form_Load()
PlaySound "C:\WINDOWS\MEDIA\TADA.WAV", ByVal 0&, SND_FILENAME Or SND_ASYNC
End Sub
<table border=0 cellspacing=0 cellpadding=4 bgcolor=#E0E0E0><tr><td class=code>

++
0
Rejoignez-nous