|
-
June 13th, 2001, 01:04 PM
#1
-
June 13th, 2001, 01:21 PM
#2
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]
-
June 15th, 2001, 11:04 AM
#3
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.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
June 15th, 2001, 11:06 AM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|