Mohon tunggu...
Wawan Supriadi
Wawan Supriadi Mohon Tunggu... lainnya -

LAHIR DI SUMEDANG TANGGAL 20 NOVEMBER 1966 -. PERNAH JADI GURU DI SMP DAN SMK SEJAK TAHUN 1988 SAMPAI TAHUN 2013. PROGRAMMER DI RSU KABUPATEN SUMEDANG - SENANG MEMPELAJARI SOFTWARE 3D ANIMATION E-Mail wulansoft.computindo@gmail.com Website :http://rsudsumedang.com

Selanjutnya

Tutup

Inovasi

VB6 : Membuat Media Player Sendiri

15 November 2009   14:20 Diperbarui: 26 Juni 2015   19:19 1945
+
Laporkan Konten
Laporkan Akun
Kompasiana adalah platform blog. Konten ini menjadi tanggung jawab bloger dan tidak mewakili pandangan redaksi Kompas.
Lihat foto
Bagikan ide kreativitasmu dalam bentuk konten di Kompasiana | Sumber gambar: Freepik

352

Height

:

29

Width

:

93

Caption

:

Exit

Sehingga tampilan kontrol pada form sebagai berikut

Sekarang kita tulis kodenya

Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long

Private Declare Function GetActiveWindow Lib "user32" () As Long

Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long

Dim wHandler As Long

Dim fShortName As String, TrackLength As String * 60

Dim a As Integer, cou As Integer

Dim tt As Boolean

Public Function GetShortName(ByVal sLongFileName As String) As String

Dim lRetVal As Long

Dim sShortPathName As String

Dim iLen As Integer

sShortPathName = Space(255)

iLen = Len(sShortPathName)

lRetVal = GetShortPathName(sLongFileName, sShortPathName, iLen)

GetShortName = Left(sShortPathName, lRetVal)

End Function

Private Sub Command1_Click()

On Error Resume Next

fShortName = GetShortName(File1.Path &  "SLASH" & File1.FileName)

mciSendString "close all", vbNullString, 0, 0

mciSendString "open " & fShortName & " type MPEGVideo style child alias mpeg parent " & Me.hwnd, vbNullString, 0, 0

mciSendString "status mpeg length", TrackLength, Len(TrackLength), 0

mciSendString "put mpeg window at 152 8 437 321", 0&, 0, 0

mciSendString "set window show maximized", vbNullString, 0, 0

mciSendString "play mpeg", vbNullString, 0, 0

HScroll1.Max = CLng(TrackLength)

Timer1.Enabled = True

End Sub

Private Sub Command2_Click()

If Command2.Caption = "Pause" Then

mciSendString "pause mpeg", vbNullString, 0, 0

Command2.Caption = "Resume"

Timer1.Enabled = False

Else

mciSendString "resume mpeg", vbNullString, 0, 0

Command2.Caption = "Pause"

Timer1.Enabled = True

End If

End Sub

Private Sub Command3_Click()

mciSendString "stop mpeg", vbNullString, 0, 0

mciSendString "close all", vbNullString, 0, 0

Timer1.Enabled = False

End Sub

Private Sub Command4_Click()

End

End Sub

Private Sub Dir1_Change()

File1.Path = Dir1.Path

cou = File1.ListCount

End Sub

Private Sub Drive1_Change()

Dir1.Path = Drive1.Drive

End Sub

Private Sub File1_Click()

a = File1.ListIndex

Command1_Click

If tt = True Then Command3_Click

End Sub

Private Sub Form_Load()

Me.Left = 1

Me.Top = 5

Drive1.Drive = "C:"

a = 0

tt = False

End Sub

Private Sub HScroll1_Change()

mciSendString "stop mpeg", vbNullString, 0, 0

mciSendString "play mpeg from " & CStr(HScroll1.Value), vbNullString, 0, 0

End Sub

Private Sub Timer1_Timer()

On Error Resume Next

Dim CurPos As String * 40

mciSendString "status mpeg position", CurPos, Len(CurPos), 0

HScroll1.Value = CLng(CurPos)

If HScroll1.Value >= HScroll1.Max Then

Timer1.Enabled = False

a = a + 1

If a < cou Then

HScroll1.Value = 0

File1.ListIndex = a

Else

a = 0

HScroll1.Value = 0

File1.ListIndex = a

End If

End If

End Sub

Selamat mencoba

CATATAN :

Berhubung pada tulisan ini tdiak bisa menampilkan tanda Slah, maka bila pada coding ada tulisan

SLASH  ganti dengan tanda

HALAMAN :
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
Mohon tunggu...

Lihat Inovasi Selengkapnya
Beri Komentar
Berkomentarlah secara bijaksana dan bertanggung jawab. Komentar sepenuhnya menjadi tanggung jawab komentator seperti diatur dalam UU ITE

Belum ada komentar. Jadilah yang pertama untuk memberikan komentar!
LAPORKAN KONTEN
Alasan
Laporkan Konten
Laporkan Akun