VB projects - MCI Sound Player
Description: playing sounds with MS Multimedia Control
Minimum requirements: VB6
Download: source code
Screenshot:

Project: EXE
Controls: CommandButton cmdFile, TextBox txtFile, CommonDialog dlg, MMControl mci, Label lblStatus
Additional references: none
Code:
Option Explicit
Private Sub cmdFile_Click()
dlg.FileName = "*.wav"
dlg.ShowOpen
txtFile = dlg.FileName
mci.Command = "Close"
mci.FileName = txtFile
mci.Command = "Open"
End Sub
Private Sub Form_Load()
txtFile = "ringin.wav"
With mci
.Notify = False
.Wait = True
.UpdateInterval = 1000
.TimeFormat = 0
.FileName = txtFile
.Command = "Open"
End With
End Sub
Private Sub mci_StatusUpdate()
lblStatus = mci.Position & " of " & mci.Length & " milliseconds"
If mci.Position = mci.Length Then
mci.Command = "Close"
mci.FileName = txtFile
mci.Command = "Open"
End If
End Sub
|