1. Waktu Yang Dibutuhkan Untuk Menjalankan File WA, AVI, dan MIDI

Tips ini berguna untuk mengetahui berapa banyak waktu yang dibutuhkan untuk menjalankan file WAV, AVI, MIDI

Persiapan :

  1. Buat 1 Module
  2. Buat 1 Form

Ketikkan Coding berikut pada Module :

Declare Function mciSendString Lib “winmm” Alias “mciSendStringA” (ByVal As Strig, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallBack As Long) As Long

 

Ketikkan Coding berikut ini pada Form:

Function GetMediaLength (FileName As String)

Dim MediaLength As Long

Dim RetString As String * 256

Dim CommandString As String

 

‘membuka File Media

CommandString =”Open ” & FileName & ” alias MediaFile” mciSendString CommandString, vbNullString, 0, 0&

 

‘Mendapatkan panjang file media

CommandString = “Atur Format waktu MediaFile ke millisecond” mciSendString CommandString, vbNullString, 0, 0&

CommandString = “Status panjang MediFile ”
mciSendString CommandString, RetString, Len (RetString), 0&

GetMediaLngth = CLng (RetString)

 

‘Menutup File Media

CommandString = “Menutup MediaFIle”

mciSendString CommandString, vbNullString, 0, 0&

End Function

 

Private Sub Form_Load()

Dim Detik, Menit As Integer

Dim MilliSecond As Long

‘Ganti “C:\Documents and Settings\Ukiz Bebbo Akhmad\My Documents\ipod\New Folder\emo.avi” dengan path ke file media anda

 

MilliSecond = GetMediaLength (“C:\Documents and Settings\Ukiz Bebbo Akhmad\My Documents\ipod\New Folder\emo.avi”)

‘Fungsi dari GetMediaLength akan  mengembalikan panjang file media dalam millisecond, kemudian akan menghitung total waktu (detik & menit)

 

Detik = Int(MilliSecond / 1000) Mod 60

Menit = Int(MilliSecond /60000)

MilliSecond = MilliSecond Mod 1000

 

TotalTime = Menit & ” : ” & Detik & ” : ” & MilliSecond

MsgBox (TotalTime)

End Sub

Semoga Ilmu yang saya bagi bermanfaat..

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s