How can i play a WAV file in VB?
Please Help!@
http://forums.codeguru.com/http://forums.codeguru.com/http://forums.codeguru.com/http://forums.codeguru.com/
All At http://www.maxcode.com/
------------------------------------
Clemens Timmermans (17-Year old)
-------------------------------------
- 'The Matrix has you, NEO' -(quote from: the Matrix)
Re: How can i play a WAV file in VB?
Use the MCI control. Set it's Wait property to False before executing the
Play command. The program continues executing while the file plays.
' Open the device and play the sound.
private Sub cmdPlay_Click()
' Disable this button.
cmdPlay.Enabled = false
' set the file name.
MMControl1.FileName = txtFilename.Text
' Open the MCI device.
MMControl1.Wait = true
MMControl1.Command = "Open"
' Play the sound without waiting.
MMControl1.Notify = true
MMControl1.Wait = false
MMControl1.Command = "Play"
' Enable the timer.
tmrSound.Enabled = true
cmdStop.Enabled = true
End Sub
The MCI control's Done event fires when the control has finished playing
the WAV file.
' Close the device when the sound is done.
private Sub MMControl1_Done(NotifyCode as Integer)
' Close the device.
MMControl1.Command = "Close"
' Disable the timer.
tmrSound.Enabled = false
cmdStop.Enabled = false
' Reenable the button.
cmdPlay.Enabled = true
End Sub
Iouri Boutchkine
[email protected]
Re: You sure it was a question?
...Or was not it a way to tell us your site is back??
;)
Cheers,
Cesare
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
Re: You sure it was a question?
both :)
http://forums.codeguru.com/http://forums.codeguru.com/http://forums.codeguru.com/http://forums.codeguru.com/
All At http://www.maxcode.com/
------------------------------------
Clemens Timmermans (17-Year old)
-------------------------------------
- 'The Matrix has you, NEO' -(quote from: the Matrix)