
Play WAV sound on event??
Hi,
I worked some time ago a less sophisticated code that works very well
and uses a registry entry to look up the WAV directory here's the
code:
============Begin Code==================
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA"
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Sub tone(ByVal Tn As Variant)
Dim wdir As String, I As Integer
On Local Error GoTo Err_tone
wdir = GetSetting(RegApp, RegGlobal, "sounddir", ".") & "\"
If IsNull(wdir) Then
Tn = 0
ElseIf Dir$(wdir + "*.wav") = "" Then
Tn = 0
End If
If VarType(Tn) = 8 Then ' string
I = sndPlaySound(wdir + Tn + ".wav", 1)
Else
Beep
End If
Exit Sub
Err_tone:
Beep
Exit Sub
End Sub