MediaPlayer




Private Sub Command1_Click()
On Error Goto ErrHandler
CommonDialog1.CancelError = True
CommonDialog1.Filter = "MIDI Sequence _
(*.mid; *.rmi)|*.mid; *.rmi|WAV Sound _
(*.wav)|*.wav|MP3 (*.mp3)|*.mp3"
CommonDialog1.ShowOpen

If CommonDialog1.Filename <> "" Then
Mediaplayer1.Filename = CommonDialog1.Filename
Mediaplayer1.Autostart = False
Mediaplayer1.Stop
Form1.Caption = CommonDialog1.FileTitle
End If

Exit Sub
ErrHandler:
End Sub

Private Sub Command2_Click()
Mediaplayer1.Play
End Sub
Assumes:
1) Press Ctrl + T
2) Find "Microsoft Common Dialog Control 5.0(or 6.0)," and
"Windows Media Player," and put checkmarks in the
checkboxes.
3) Add the two new controls to the form, and add two
CommandButtons.
4) Set the caption of the first CommandButton to "&Open,"
and the caption of the second CommandButton to "&Play".











( mediaplayer.html )- by Paolo Puglisi - Modifica del 17/12/2023