how are you able to play sounds? (code) how can you stop sounds while playing? Can you load them into a file(hopefully .res)?
thanks in advance!
Printable View
how are you able to play sounds? (code) how can you stop sounds while playing? Can you load them into a file(hopefully .res)?
thanks in advance!
Option Explicit
'
Private Declare Function PlaySound Lib "winmm.dll" Alias _
"PlaySoundA" (ByVal IpszName as String, ByVal hModule As _
Long, ByVal dwFlags As Long) As Long
'
Private Const SND_FILENAME = &H20000 ' name is a filename
Private Const SND_AYSNC = &H1 ' play asynchronously
Private Const SND_SYNC = &H0
'
Private Sub PlayASound()
PlaySound App.Path & "\JamesBrown.wav",0,SND_SYNC
End Sub
Hope it helps...of course you could always BEEP
could you clarify what all of that does....?
Check out this sister site for info on API's (this link will take you to the function described above):
http://www.vbapi.com/ref/p/playsound.html
Or use the sndPlaySound API.
Code for module.
Code to play sound.Code:Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
And, yes you can add them to a RES file.Code:Call sndPlaySound("C:\MySound.wav", &H1)
All it does it replays .wav files. We have a whole series of sound bits etc which play during different events, we use this call to play them. Doesn't do anything else, just plays wav files...though will try out Megs API call.