home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmControlPanel
- BorderStyle = 1 'Fixed Single
- Caption = "CD Player"
- ClientHeight = 1128
- ClientLeft = 1092
- ClientTop = 1512
- ClientWidth = 2928
- Height = 1452
- Left = 1044
- LinkTopic = "Form1"
- ScaleHeight = 1128
- ScaleWidth = 2928
- Top = 1236
- Width = 3024
- Begin MCI.MMControl mciControl
- Height = 735
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 2940
- _Version = 65536
- StepVisible = 0 'False
- RecordVisible = 0 'False
- DeviceType = "CDAudio"
- _ExtentX = 5186
- _ExtentY = 1291
- _StockProps = 32
- BorderStyle = 1
- End
- Attribute VB_Name = "frmControlPanel"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- ' Controls the form and MCI control.
- ' This is the internal representation of a CD
- ' within the applications (exposed as as Title
- ' and Tracks outside of the application).
- Option Explicit
- ' Internal CurrentTitle property
- ' (Read/write)
- Public CurrentTitle As String
- Public Property Get Position() As Long
- Position = Me.mciControl.Position
- End Property
- Public Property Get ElapsedMinutes() As Integer
- ElapsedMinutes = LoByte(LoWord(Me.Position))
- End Property
- Public Property Get ElapsedSeconds() As Integer
- ElapsedSeconds = HiByte(LoWord(Me.Position))
- End Property
- Public Property Get CurrentTrack()
- ' This doesn't work -- bug in control?
- ' CurrentTrack = HiByte(HiWord(Me.Position))
- ' Alternate -- works?
- Dim Index As Integer
- Dim lTrackBegin As Long
- Dim lTrackEnd As Long
- Dim lCurrentPosition As Long
- lCurrentPosition = Me.Position
- For Index = 1 To Me.Tracks
- Me.Track = Index
- lTrackBegin = Me.TrackPosition
- lTrackEnd = lTrackBegin + Me.TrackLength
- If (lTrackBegin < lCurrentPosition) And (lCurrentPosition < lTrackEnd) Then
- CurrentTrack = Index
- Exit Property
- End If
- Next Index
- End Property
- Public Property Get Tracks() As Integer
- Tracks = Me.mciControl.Tracks
- End Property
- Public Property Get Track() As Integer
- Track = Me.mciControl.Track
- End Property
- Public Property Let Track(iSetting As Integer)
- Me.mciControl.Track = iSetting
- End Property
- Public Property Get TrackPosition() As Long
- TrackPosition = Me.mciControl.TrackPosition
- End Property
- Public Property Get TrackLength() As Long
- TrackLength = Me.mciControl.TrackLength
- End Property
- Public Property Let Command(strSetting As String)
- Me.mciControl.Command = strSetting
- End Property
- Public Sub Play()
- Me.mciControl.Command = "Open"
- Me.mciControl.Command = "Play"
- End Sub
- Public Sub Eject()
- Me.mciControl.Command = "Eject"
- End Sub
- Public Sub NextTrack()
- Me.mciControl.Notify = False
- Me.mciControl.Wait = True
- Me.mciControl.Command = "Next"
- End Sub
- Public Sub PreviousTrack()
- Me.mciControl.Notify = False
- Me.mciControl.Wait = True
- Me.mciControl.Command = "Prev"
- Me.mciControl.Command = "Prev"
- End Sub
- Private Function LoWord(lVal As Long) As Integer
- If lVal And &HFFFF0000 Then
- LoWord = lVal Mod (lVal And &HFFFF0000)
- Else
- LoWord = lVal
- End If
- End Function
- Private Function HiWord(lVal As Long) As Integer
- HiWord = (lVal And &HFFFF0000) \ &H10000
- End Function
- Private Function HiByte(iVal As Integer) As Byte
- HiByte = (iVal And &HFF00) \ &H100
- End Function
- Private Function LoByte(iVal As Integer) As Byte
- If iVal And &HFF00 Then
- LoByte = iVal Mod (iVal And &HFF00)
- Else
- LoByte = iVal
- End If
- End Function
- Private Sub Form_Load()
- Me.mciControl.AutoEnable = True
- Me.mciControl.TimeFormat = mciFormatTmsf
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- Set Application = Nothing
- End Sub
- Private Sub mciControl_Done(NotifyCode As Integer)
- End Sub
-