Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


Visual Basic Programming Code Examples

Visual Basic > Multimedia Animation and Sound Code Examples

How to play a WAV file with VB.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
How to play a WAV file with VB. Sub PlayWav(SoundName As String) Dim tmpSoundName As String Dim wFlags%, X% ' declare statements (Place in a bas module.) '#If Win32 Then 'Public Declare Function sndPlaySound& Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) '#Else 'Public Declare Function sndPlaySound% Lib "mmsystem.dll" (ByVal lpszSoundName As String, ByVal uFlags As Integer) '#End If 'WIN32 ' ' WAV Sound values 'Global Const SND_SYNC = &H0 'Global Const SND_ASYNC = &H1 'Global Const SND_NODEFAULT = &H2 'Global Const SND_LOOP = &H8 'Global Const SND_NOSTOP = &H10 ' *** pathWavFiles is a var with the subDir where ' the sound files are stored tmpSoundName = pathWavFiles & SoundName wFlags% = SND_ASYNC Or SND_NODEFAULT X% = sndPlaySound(tmpSoundName, wFlags%) End Sub