VBcoders Guest

Don't have an account yet? Register

Forgot Password?

3 lines of codes

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.

Rate 3 lines of codes

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_LOOP = &H8
Const SND_NOSTOP = &H10
'----------PLAY WAVE SOUND--------
Private Sub PlayWaveSound_Click()
 soundfile$ = "c:/TheCustomSoundIWant.wav"
 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

Download this snippet    Add to My Saved Code

3 lines of codes Comments

No comments have been posted about 3 lines of codes. Why not be the first to post a comment about 3 lines of codes.

Post your comment

0/1000 characters