Rabu, 08 Juni 2016

Cara membuat aplikasi pemuta musik dengan Visual Basic 6.0

     Berikut ini saya akan memberitahu cara membuat  aplikasi pemutar musik dengan Visual Basic 6.0. Kita sering menggunakan aplikasi pemutar musik buatan orang lain, seperti Windows media player, VLC media player, dan aplikasi pemutar musik lain nya. Sekarang kita akan membuat pemutar musik sendiri.

Berikut adalah langkah-langkah membuat aplikasi pemutar musik :

1. Buka VB 6.0 dengan project Standard.exe
2. Klik Ctrl+T. Ceklis "Microsoft Common Dialog Control 6.0" dan "Microsoft Multimedia Control 6.0"
3. Masukkan 1 buah label, 1 buah DirlistBox,1 buah FileListBox,1 buah DriveListBox,1 buah MMcontrol.
4. Susun semua Component seperti ini















 5. Lalu masukkan Code nya seperti ini :

Private Sub Dir1_Change()

File1.Path = Dir1
End Sub

Private Sub Drive1_Change()

Dir1 = Drive1.Drive

End Sub

Private Sub File1_Click()

Label1.Caption = File1.FileName

MMControl1.Command = "close"

MMControl1.FileName = File1.Path + "\" + File1.FileName

MMControl1.Command = "open"

MMControl1.Command = "play"
End Sub

Private Sub Form_Load()

MMControl1.BackVisible = False

MMControl1.StepVisible = False

MMControl1.RecordVisible = False

MMControl1.EjectVisible = False

File1.Pattern = "*.mp3"
End Sub




Private Sub MMControl1_Done(NotifyCode As Integer)

Dim a As Integer

On Error GoTo salah

If MMControl1.Position = MMControl1.Length Then

a = File1.ListIndex

a = a + 1

File1.Selected(a) = True

File1_Click

salah:

Exit Sub

End If
End Sub

 6. Jalankan dengan menekan tombol F5.

Selesai......

Sekian tutorial Cara membuat aplikasi pemutar musik dari saya.Semoga bermanfaat.

Download Source Code nya Disini

Cara membuat jam analog dengan Visual Basic 6.0

     Berikut ini saya akan memberitahu cara membuat jam analog di Visual Basic 6.0. Jam analog banyak diperlukan oleh para programmer, seperti untuk membuat bel otomatis,dan lain lain. Jam analog juga diperlukan untuk menghiasi suatu aplikasi agar tampak lebih menarik.

















Berikut adalah langkah-langkah membuat jam analog:

1. Buka Visual Basic 6.0 dengan project standar.exe
2. Buat 3 buah line dengan nama "LineSecond","LineMinute","LineHour"
3. Cari salah satu gambar jam,lalu buat component PictureBox 1 buah.
4. lalu masukkan gambar jam tadi.
5. Masukkan Code nya seperti berikut.


Option Explicit

Private Const pi As Double = 3.14159265358979

Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long


Private Sub MakeRoundObject(objObject As Object, Value As Long)
    Static lngHeight, lngLong, lngReturn, lngWidth As Long
   
    lngWidth = objObject.Width / Screen.TwipsPerPixelX
    lngHeight = objObject.Height / Screen.TwipsPerPixelY
                 
    SetWindowRgn objObject.hWnd, CreateRoundRectRgn(0, 0, lngWidth, lngHeight, Value, Value), True
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyEscape Then
        App.TaskVisible = False
        Unload Me
        End
    End If
End Sub

Private Sub Form_Load()
    Dim intX As Integer
   
    Call MakeRoundObject(Picture2, 300)
    Call tmrClock_Timer
   
    For intX = 0 To 360 Step 6
        If intX Mod 30 = 0 Then
            Me.DrawWidth = 6
            Me.PSet (1100 * Cos(intX * pi / 180) + Linesecond.X1, 1100 * Sin(intX * pi / 180) + Linesecond.Y1)
        Else
            Me.DrawWidth = 3
            Me.PSet (1100 * Cos(intX * pi / 180) + Linesecond.X1, 1100 * Sin(intX * pi / 180) + Linesecond.Y1)
        End If
    Next intX
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ReleaseCapture
    SendMessage Me.hWnd, &HA1, 2, 0&
End Sub

Private Sub lblTime_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Call Form_MouseDown(Button, Shift, X, Y)
End Sub

Private Sub tmrClock_Timer()
    Dim dblSecond As Double, dblMinute As Double, dblHour As Double
   
    dblSecond = Second(Now) * 6 - 90
    dblMinute = (Minute(Now) + Second(Now) / 60) * 6 - 90
    dblHour = (Hour(Now) + Minute(Now) / 60) * 30 - 90

    Linesecond.X2 = 1000 * Cos(dblSecond * pi / 180) + Linesecond.X1
    Linesecond.Y2 = 1000 * Sin(dblSecond * pi / 180) + Linesecond.Y1
    LineMinute.X2 = 900 * Cos(dblMinute * pi / 180) + LineMinute.X1
    LineMinute.Y2 = 900 * Sin(dblMinute * pi / 180) + LineMinute.Y1
    Linehour.X2 = 700 * Cos(dblHour * pi / 180) + Linehour.X1
    Linehour.Y2 = 700 * Sin(dblHour * pi / 180) + Linehour.Y1
   
End Sub

 6. Jalankan dengan menekan tombol F5.

Selesai.......
Selamat mencoba......

Download Source Codenya Disini