by Power Of Anubis (7 Submissions)
Category: Sound/MP3
Compatability: VB Script
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (12 Votes)
Play a wave file with only 3 lines of codes!
It works with .wav files 100%, with other extension I don't know. Try and then report.
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10
'----------PLAY WAVE SOUND--------
Private Sub PlayWaveSound_Click()
soundfile$ = "c:/TheCustomSoundIWant.wav"
wFlags% = SND_ASYNC Or SND_NODEFAULT
HaHa = sndPlaySound(soundfile$, wFlags%)
End Sub
'-------STOP WAVE SOUND-------
Private Sub StopTheSound_Click()
StopTheSoundNOW = sndPlaySound(soundfile$, wFlags%)
End Sub
'Replace "c:/TheCustomSoundIWant.wav" with your sound