Results 1 to 3 of 3

Thread: Progress bar with cd track time limit

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    England
    Posts
    6

    Cool

    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!
    -------------
    Welcome to the Darkness

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    England
    Posts
    6

    Talking 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
    -------------
    Welcome to the Darkness

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width