-
Hey ppl...
Anyone know how I get a Progress bar to have the minimum value of 0 (obviously) but the maximum value of whatever the total time is of a specific track/music file.
Basically I just want it to get to the end of the progress bar when ever the track/file has finished being played.
Please don't assume I know all the commands to this damned program!
Cheers!
-
Add a MMControl and a Picturebox to a Form:
Code:
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Sub Form_Load()
With MMControl1
.DeviceType = "CDAudio"
.FileName = "H:" 'Change this to your CDROM Drive Letter
.AutoEnable = True
.UpdateInterval = 10
.Command = "OPEN"
End With
End Sub
Private Sub MMControl1_StatusUpdate()
Dim lTime As Long
Dim bBytes(3) As Byte
Dim lPos As Long
Static lTrackLength As Long
Static lTrack As Long
If MMControl1.Mode <> mciModePlay Or lTrackLength = 0 Or lTrack <> MMControl1.Track Then
lTime = MMControl1.TrackLength
CopyMemory bBytes(0), lTime, 4
Caption = "Track: " & MMControl1.Track & " - " & Right("00" & bBytes(0), 2) & ":" & Right("00" & bBytes(1), 2)
lTrackLength = (60 * bBytes(0)) + bBytes(1)
Picture1.Cls
lTrack = MMControl1.Track
Else
lTime = MMControl1.Position - MMControl1.TrackPosition
CopyMemory bBytes(0), lTime, 4
lPos = (bBytes(0) * 60) + bBytes(1)
Picture1.Line (0, 0)-((Picture1.ScaleWidth / lTrackLength) * lPos, Picture1.ScaleHeight), vbBlue, BF
End If
End Sub
-
Cheers
Thanks for that!
I should have checked the rest of the toolbox for MMControl!
I've been fiddling around with large amounts of funtions and API calls etc... this is alot more compact etc!
cheers again