Can anyone tell me a simple way to play a wave file. I have started to look at the MMcontrol but though I would first look for a more simpiler way.
TIA
Printable View
Can anyone tell me a simple way to play a wave file. I have started to look at the MMcontrol but though I would first look for a more simpiler way.
TIA
you can use the API fxn, "sndPlaySound".
the declaration is:
Public Declare Function sndPlaySound& lib "winmm.dll" Alias
"sndPlaySoundA" (byval lpszSoundName as string, byval
uFlags as long)
'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
an example on how to use the above fxn...
Code:' Declare the API and the global variables
' say you want to play wav on a button's on
' click action
Private Sub Command1_Click()
Dim wFlags%
Dim x%
Dim tmpSoundName As String
tmpSoundName = "c:\windows\chimes.wav"
wFlags% = SND_ASYNC Or SND_NODEFAULT
x% = sndPlaySound(tmpSoundName, wFlags%)
End Sub