Make your own free website on Tripod.com

Multimedia Player

I have created a multimedia player that can play all kinds of media files such as wav, midi, mp3, mpeg video, avi video and so on. When you launch the program, you can select files of different types from different drives. After you have selected a particular files, you can play it using the customized button or you can use the buttons of the multimedia control

In this program, you need to insert the Microsoft Multimedia Control, a combo box, a dirListBox, a DriveListBox, a fileListbox, a picture box(to play the video) , a text box and four command buttons which you label as "Play", "Open","Stop" and "Exit".

The code is as follows:


Private Sub Form_Load()
Left = (Screen.Width - Width) \ 2
Top = (Screen.Height - Height) \ 2
Combo1.Text = "*.wav"
Combo1.AddItem "*.wav"
Combo1.AddItem "*.mid"
Combo1.AddItem "*.avi"
Combo1.AddItem "*.mpeg;*.mpg;*.mp3"
Combo1.AddItem "All files"
End Sub

Private Sub Combo1_Change()
If ListIndex = 0 Then
File1.Pattern = ("*.wav")
ElseIf ListIndex = 1 Then
File1.Pattern = ("*.mid")
ElseIf ListIndex = 2 Then
File1.Pattern = ("*.avi")
ElseIf ListIndex = 3 Then
File1.Pattern = ("*.mpeg;*.mpg;*.mp3")
Else
Fiel1.Pattern = ("*.*")
End If

End Sub


Private Sub Dir1_Change()
File1.Path = Dir1.Path
If Combo1.ListIndex = 0 Then
File1.Pattern = ("*.wav")
ElseIf Combo1.ListIndex = 1 Then
File1.Pattern = ("*.mid")
ElseIf Combo1.ListIndex = 2 Then
File1.Pattern = ("*.avi")
ElseIf Combo1.ListIndex = 3 Then
File1.Pattern = ("*.mpeg;*.mpg;*.mp3")
Else
File1.Pattern = ("*.*")
End If
End Sub

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub

Private Sub Exit_Click()
End
End Sub

Private Sub File1_Click()
If Combo1.ListIndex = 0 Then
File1.Pattern = ("*.wav")
ElseIf Combo1.ListIndex = 1 Then
File1.Pattern = ("*.mid")
ElseIf Combo1.ListIndex = 2 Then
File1.Pattern = ("*.avi")
ElseIf Combo1.ListIndex = 3 Then
File1.Pattern = ("*.mpeg;*.mpg;*.mp3")
Else
File1.Pattern = ("*.*")
End If

If Right(File1.Path, 1) <> "\" Then
filenam = File1.Path + "\" + File1.FileName
Else
filenam = File1.Path + File1.FileName
End If
Text1.Text = filenam

End Sub



Private Sub MMControl1_Click()

End Sub

Private Sub Open_Click()
If Combo1.ListIndex = 0 Then
MMControl1.DeviceType = "WaveAudio"
End If
If Combo1.ListIndex = 1 Then
MMControl1.DeviceType = "Sequencer"
End If

If Combo1.ListIndex = 2 Then
MMControl1.DeviceType = "AVIVideo"
End If
If Combo1.ListIndex = 3 Then
MMControl1.DeviceType = ""

End If


MMControl1.FileName = Text1.Text
MMControl1.Command = "Open"
End Sub

Private Sub play_Click()
MMControl1.Command = "Play"
MMControl1.hWndDisplay = Picture1.hWnd
End Sub


Private Sub stop_Click()
If MMControl1.Mode = 524 Then Exit Sub
If MMControl1.Mode <> 525 Then
MMControl1.Wait = True
MMControl1.Command = "Stop"
End If
MMControl1.Wait = True
MMControl1.Command = "Close"
End Sub

 

Back to Games page