Search Tools Links Login

[ 3 lines of codes ]


Visual Basic 6, or VB Classic

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.

Original Author: Power Of Anubis

Code

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

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 115 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.