ZjiÜt∞nφ dΘlky celΘho CD

Postup:
Na formulß° p°idejte TextBox a MCI control. Na udßlost Form_Load zapiÜte:

Sub Form_Load ()

   
' Inicializace CD:
   mmcontrol1.TimeFormat = 10
   mmcontrol1.DeviceType = "CDAudio"
   mmcontrol1.Command = "Open"

   Dim Length As Variant
   Dim CDSeconds As Integer, CDMinutes As Integer

   ' Kalkulace minut a sekund:
   CDSeconds = CDSeconds + (mmcontrol1.Length And &HFF00&) / &H100
   CDMinutes = CDMinutes + (mmcontrol1.Length And &HFF)

   ' Sumarizace minut a sekund:
   Length = DateAdd("s", CDSeconds, Length)
   Length = DateAdd("n", CDMinutes, Length)

   ' ZjiÜt∞nφ, zda je celkov² Φas v∞tÜφ ne₧ hodina:
   If (Left$(Length, 2)) = "12" Then
      Text1.Text = Mid(Length, 4, (Len(Length) - 4))
   Else
      Text1.Text = Left(Length, (Len(Length) - 3))
   End If

End Sub

Zp∞t

Autor: The Bozena