Di bawah ini merupakan contoh menggunakan Microsoft Multimedia Control yang digunakan untuk menjalankan file .mp3 menggunakan VB6.
READ MORE - VB6 Code - Menjalankan File .mp3
Option Explicit
Private Sub Command1_Click()
MMC.FileName = OpenFile
Me.Caption = MMC.FileName
MMC.Command = "open"
MMC.Command = "play"
End Sub
Private Function OpenFile() As String
With CommonDialog1
.FileName = ""
.DialogTitle = "Open Files"
.InitDir = "C:\My Documents"
.Filter = "MP3 File (*.MP3)|*.MP3"
.ShowOpen
If .FileName = "" Then Exit Function
MMC.Command = "stop"
OpenFile = .FileName
End With
End Function
Private Sub Command2_Click()
MMC.Command = "stop"
End Sub