home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Programmer'…arterly (Limited Edition)
/
Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso
/
code
/
ch17code
/
player.cls
< prev
next >
Wrap
Text File
|
1995-08-13
|
2KB
|
110 lines
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Application"
Attribute VB_Creatable = True
Attribute VB_Exposed = True
' Application class -- PLAYER.CLS
' Controls the frmCD form.
'
' Methods:
'
' Properties:
'
Option Explicit
Private mCurrentTitle As New Title
' Name property (read only) -- can't do this!
' Public Const Name = "CD Player"
' Name property
Public Property Get Name()
Name = "CD Player"
End Property
' Create method.
Public Sub Class_Initialize()
' Initialize Control Panel form.
Set ControlPanel = frmControlPanel
' Display the control panel.
ControlPanel.Show
' Open the MCI control.
ControlPanel.Command = "Open"
' Create a new title
Set mCurrentTitle = mCurrentTitle.Create
' Set the parent of the object
mCurrentTitle.Parent Me, FLAG_INTERNAL
End Sub
' Delete method.
Private Sub Class_Terminate()
ControlPanel.Command = "Stop"
Unload ControlPanel
Set ControlPanel = Nothing
End Sub
' Play method
Public Sub Play()
ControlPanel.Play
End Sub
' Eject method
Public Sub Eject()
ControlPanel.Eject
End Sub
' StopCD method (Stop keyword is reserved)
Public Sub StopPlaying()
ControlPanel.Command = "Stop"
End Sub
' PlayNext method
Public Sub PlayNext()
ControlPanel.NextTrack
End Sub
' PlayPrevious method
Public Sub PlayPrevious()
ControlPanel.PreviousTrack
End Sub
' Quit method.
Public Sub Quit()
' Stop playing.
ControlPanel.Command = "Stop"
' End application.
End
End Sub
' Title property
' Read only
Public Property Get Title() As Object
Set Title = mCurrentTitle
End Property
' Visible property.
' Delegates to form's Visible property.
' Read/Write
Public Property Get Visible() As Boolean
Visible = ControlPanel.Visible
End Property
Public Property Let Visible(bSetting As Boolean)
ControlPanel.Visible = bSetting
End Property
Public Property Get ElapsedTime() As String
Dim strSeconds As String
Dim strMinutes As String
strSeconds = ControlPanel.ElapsedSeconds
If Len(strSeconds) = 1 Then strSeconds = "0" & strSeconds
strMinutes = ControlPanel.ElapsedMinutes
If Len(strMinutes) = 1 Then strMinutes = "0" & strMinutes
ElapsedTime = strMinutes & ":" & strSeconds
End Property
Public Property Get Parent() As Object
Set Parent = Me
End Property