MCISendString (wav)

I'm wondering how to play a wav file, i've read that we need mciSendString API.

I wrote this code in a module and wondering if it's the good one or we have to use something else...

Declare Function sndPlaysound Lib "winmm.lib" (ByVal pszSound As String, _
ByVal hmod As Any, ByVal fdwsound As Any) As Long

Thank you in advance for your time
Lutar
lutharAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

koomCommented:
If you want to play a wav file do this


' In the Declarations of one form

Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2

' Insert a Command Button

Private Sub Command1_Click()
 
filename = "c:\sound.wav"  
       
'type this to play the sound
 
sndPlaySound filename, SND_ASYNC

End Sub

----------------------------------
Bye

Koom

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lutharAuthor Commented:
Ok this is great but is there a way to close it :D let's say when i click on command2...

Thanks :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.