Rabu, 31 Oktober 2012

Cara Membuat MP3 Player Menggunakan VB 0.6



Cara Membuat MP3 Player Menggunakan VB 0.6   

1. Buka program VB 6.0 dan pilih Standart.EXE
2. Masukkan 5 buah CommandButton, 1 buah komponen media player (msdxm.ocx) dan 2 buah ListBox kedalam Form1. Atur Posisinya seperti gambar di bawah ini:

 3. Ganti Caption dari setiap tombol menjadi :
4. Masukkan 1 buah Form (Form2) kedalam Projects dan tambahkan 1 buah DriveListbox, 1 buah DirListbox, 2 buah CommandButton dan 1 buah FileListBox kedalam Form2. Atur seperti gambar di bawah ini: Ubah Caption Command1 = Add dan Caption Command2 = Cancel Untuk FileListBox ubah Pattern = *.mp3 Tampilan Form2 akan menjadi seperti ini :
 Ubah Caption Command1 = Add dan Caption Command2 = Cancel Untuk FileListBox ubah Pattern = *.mp3 Tampilan Form2 akan menjadi seperti ini :

5. Masukkan lagi 1 buah Form (Form3) ke dalam Project anda dan tambahkan 1 buah DriveListBox, 1 buah DirListBox, dan 2 buah CommandButton. Atur Seperti gambar di bawah ini:
  
           Ubah Caption Command1 = Add dan Caption Command2 = Cancel

 6. Ubah Properties dari Form1, Form2 & Form3
      a. Form1
                Caption = Mp3 Player
 StartUpPosition = 2-Center Screen
       b. Form2
Caption = Add File
StartUpPosition = 2-Center Screen
       c. Form3
Caption = Add Foler
StartUpPosition = 2-Center Screen


Code MP3
Kode/ Listing Form1 :
Private Sub Command1_Click()
MediaPlayer1.Open List2
End Sub

Private Sub Command2_Click()
 MediaPlayer1.Stop
 End Sub

 Private Sub Command3_Click()
 If MediaPlayer1.IsDurationValid = False Then Exit Sub
 If Command3.Caption = "Pause" Then MediaPlayer1.Pause
 Command3.Caption = "Resume"
 Else
 MediaPlayer1.Play
 Command3.Caption = "Pause"
 End If
 End Sub

 Private Sub Command4_Click()
 Form2.Show
 End Sub

Private Sub Command5_Click()
Form3.Show
End Sub

Private Sub List1_Click()
 List2.ListIndex = List1.ListIndex
End Sub

Private Sub List1_DblClick()
 Command1_Click
 End Sub


Kode/ Listing Form2 :

Private Sub Command1_Click()
 Form1.List1.AddItem File1
Form1.List2.AddItem Dir1.Path & "\" & File1
End Sub

 Private Sub Command2_Click()
Unload Me
 End Sub

 Private Sub Dir1_Change()
 File1.Path = Dir1.Path
End Sub

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

 Private Sub File1_DblClick()
Form1.List1.AddItem File1
 Form1.List2.AddItem Dir1.Path & "\" & File1
 End Sub

Kode/ Listing Form3 :


Private Sub Command1_Click()
 Dim a As Long
Dim b As String
 If File1.ListCount = "0" Then Exit Sub: MsgBox "No files"
 For a& = 0 To File1.ListCount - 1
Form1.List1.AddItem File1.List(a&)
 Form1.List2.AddItem Dir1.Path & "\" & File1.List(a&)
Next a
 Unload Me
End Sub

Private Sub Command2_Click()
 Unload Me
End Sub

Private Sub Dir1_Change()
 File1.Path = Dir1.Path End Sub Private Sub Drive1_Change() Dir1.Path = Drive1
 End Sub


0 komentar:

Poskan Komentar

Cool Grey Outer Glow Pointer