' REPRODUCTOR DE MP3 Y M3U --- OCX invisible --- 14/Junio/2003

Public Class frmPlayer
    Inherits System.Windows.Forms.Form

#Region " Código generado por el Diseñador de Windows Forms "

    Public Sub New()
        MyBase.New()

        'El Diseñador de Windows Forms requiere esta llamada.
        InitializeComponent()

        'Agregar cualquier inicialización después de la llamada a InitializeComponent()

    End Sub

    'Form reemplaza a Dispose para limpiar la lista de componentes.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Requerido por el Diseñador de Windows Forms
    Private components As System.ComponentModel.IContainer

    'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento
    'Puede modificarse utilizando el Diseñador de Windows Forms. 
    'No lo modifique con el editor de código.
    Friend WithEvents ocxPlayer As AxWMPLib.AxWindowsMediaPlayer
    Friend WithEvents Panel2 As System.Windows.Forms.Panel
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents lbTitulo As System.Windows.Forms.Label
    Friend WithEvents lbTituloa As System.Windows.Forms.Label
    Friend WithEvents lbAutora As System.Windows.Forms.Label
    Friend WithEvents lbAutor As System.Windows.Forms.Label
    Friend WithEvents btPlay As System.Windows.Forms.Button
    Friend WithEvents btStop As System.Windows.Forms.Button
    Friend WithEvents btCerrar As System.Windows.Forms.Button
    Friend WithEvents btAbrir As System.Windows.Forms.Button
    Friend WithEvents btNext As System.Windows.Forms.Button
    Friend WithEvents btPrev As System.Windows.Forms.Button
    Friend WithEvents PictureBox3 As System.Windows.Forms.PictureBox
    Friend WithEvents lbTotal As System.Windows.Forms.Label
    Friend WithEvents lbTime As System.Windows.Forms.Label
    Friend WithEvents Timer1 As System.Windows.Forms.Timer
    Friend WithEvents lbtotal1 As System.Windows.Forms.Label
    Friend WithEvents lbTime1 As System.Windows.Forms.Label
    Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmPlayer))
        Me.ocxPlayer = New AxWMPLib.AxWindowsMediaPlayer
        Me.Panel2 = New System.Windows.Forms.Panel
        Me.lbAutora = New System.Windows.Forms.Label
        Me.lbAutor = New System.Windows.Forms.Label
        Me.lbTitulo = New System.Windows.Forms.Label
        Me.lbTituloa = New System.Windows.Forms.Label
        Me.PictureBox1 = New System.Windows.Forms.PictureBox
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
        Me.btPlay = New System.Windows.Forms.Button
        Me.btStop = New System.Windows.Forms.Button
        Me.btCerrar = New System.Windows.Forms.Button
        Me.btAbrir = New System.Windows.Forms.Button
        Me.btNext = New System.Windows.Forms.Button
        Me.btPrev = New System.Windows.Forms.Button
        Me.PictureBox3 = New System.Windows.Forms.PictureBox
        Me.lbTotal = New System.Windows.Forms.Label
        Me.lbTime = New System.Windows.Forms.Label
        Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
        Me.lbtotal1 = New System.Windows.Forms.Label
        Me.lbTime1 = New System.Windows.Forms.Label
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        CType(Me.ocxPlayer, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.Panel2.SuspendLayout()
        Me.SuspendLayout()
        '
        'ocxPlayer
        '
        Me.ocxPlayer.ContainingControl = Me
        Me.ocxPlayer.Enabled = True
        Me.ocxPlayer.Location = New System.Drawing.Point(16, 16)
        Me.ocxPlayer.Name = "ocxPlayer"
        Me.ocxPlayer.OcxState = CType(resources.GetObject("ocxPlayer.OcxState"), System.Windows.Forms.AxHost.State)
        Me.ocxPlayer.Size = New System.Drawing.Size(1, 1)
        Me.ocxPlayer.TabIndex = 1
        Me.ocxPlayer.TabStop = False
        '
        'Panel2
        '
        Me.Panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Panel2.Controls.Add(Me.lbTitulo)
        Me.Panel2.Controls.Add(Me.lbTituloa)
        Me.Panel2.Controls.Add(Me.ocxPlayer)
        Me.Panel2.Controls.Add(Me.lbAutora)
        Me.Panel2.Controls.Add(Me.lbAutor)
        Me.Panel2.Location = New System.Drawing.Point(8, 8)
        Me.Panel2.Name = "Panel2"
        Me.Panel2.Size = New System.Drawing.Size(288, 120)
        Me.Panel2.TabIndex = 6
        '
        'lbAutora
        '
        Me.lbAutora.BackColor = System.Drawing.SystemColors.Control
        Me.lbAutora.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.lbAutora.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lbAutora.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lbAutora.Location = New System.Drawing.Point(8, 8)
        Me.lbAutora.Name = "lbAutora"
        Me.lbAutora.Size = New System.Drawing.Size(264, 16)
        Me.lbAutora.TabIndex = 0
        Me.lbAutora.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'lbAutor
        '
        Me.lbAutor.BackColor = System.Drawing.SystemColors.Control
        Me.lbAutor.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.lbAutor.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lbAutor.ForeColor = System.Drawing.Color.Navy
        Me.lbAutor.Location = New System.Drawing.Point(8, 32)
        Me.lbAutor.Name = "lbAutor"
        Me.lbAutor.Size = New System.Drawing.Size(264, 16)
        Me.lbAutor.TabIndex = 2
        Me.lbAutor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        Me.ToolTip1.SetToolTip(Me.lbAutor, "Autor de la canción")
        '
        'lbTitulo
        '
        Me.lbTitulo.BackColor = System.Drawing.SystemColors.Control
        Me.lbTitulo.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.lbTitulo.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lbTitulo.ForeColor = System.Drawing.Color.Navy
        Me.lbTitulo.Location = New System.Drawing.Point(8, 80)
        Me.lbTitulo.Name = "lbTitulo"
        Me.lbTitulo.Size = New System.Drawing.Size(264, 32)
        Me.lbTitulo.TabIndex = 4
        Me.lbTitulo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        Me.ToolTip1.SetToolTip(Me.lbTitulo, "Título de la canción")
        '
        'lbTituloa
        '
        Me.lbTituloa.BackColor = System.Drawing.SystemColors.Control
        Me.lbTituloa.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.lbTituloa.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lbTituloa.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lbTituloa.Location = New System.Drawing.Point(8, 56)
        Me.lbTituloa.Name = "lbTituloa"
        Me.lbTituloa.Size = New System.Drawing.Size(264, 16)
        Me.lbTituloa.TabIndex = 3
        Me.lbTituloa.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'PictureBox1
        '
        Me.PictureBox1.BackColor = System.Drawing.Color.Transparent
        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
        Me.PictureBox1.Location = New System.Drawing.Point(312, 24)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(112, 40)
        Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.PictureBox1.TabIndex = 3
        Me.PictureBox1.TabStop = False
        Me.ToolTip1.SetToolTip(Me.PictureBox1, "Autor: Miliuco (17 de junio de 2003)")
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.RestoreDirectory = True
        '
        'btPlay
        '
        Me.btPlay.BackColor = System.Drawing.SystemColors.Control
        Me.btPlay.Cursor = System.Windows.Forms.Cursors.Default
        Me.btPlay.Enabled = False
        Me.btPlay.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.btPlay.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btPlay.ForeColor = System.Drawing.Color.Navy
        Me.btPlay.Location = New System.Drawing.Point(152, 160)
        Me.btPlay.Name = "btPlay"
        Me.btPlay.Size = New System.Drawing.Size(64, 24)
        Me.btPlay.TabIndex = 2
        Me.btPlay.Text = "Play"
        Me.ToolTip1.SetToolTip(Me.btPlay, "Tocar la canción")
        '
        'btStop
        '
        Me.btStop.BackColor = System.Drawing.SystemColors.Control
        Me.btStop.Cursor = System.Windows.Forms.Cursors.Default
        Me.btStop.Enabled = False
        Me.btStop.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.btStop.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btStop.ForeColor = System.Drawing.Color.Navy
        Me.btStop.Location = New System.Drawing.Point(296, 160)
        Me.btStop.Name = "btStop"
        Me.btStop.Size = New System.Drawing.Size(64, 24)
        Me.btStop.TabIndex = 4
        Me.btStop.Text = "Stop"
        Me.ToolTip1.SetToolTip(Me.btStop, "Detener")
        '
        'btCerrar
        '
        Me.btCerrar.BackColor = System.Drawing.SystemColors.Control
        Me.btCerrar.Cursor = System.Windows.Forms.Cursors.Default
        Me.btCerrar.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.btCerrar.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btCerrar.ForeColor = System.Drawing.Color.Navy
        Me.btCerrar.Location = New System.Drawing.Point(368, 160)
        Me.btCerrar.Name = "btCerrar"
        Me.btCerrar.Size = New System.Drawing.Size(64, 24)
        Me.btCerrar.TabIndex = 5
        Me.btCerrar.Text = "Salir"
        Me.ToolTip1.SetToolTip(Me.btCerrar, "Salir del programa")
        '
        'btAbrir
        '
        Me.btAbrir.BackColor = System.Drawing.SystemColors.Control
        Me.btAbrir.Cursor = System.Windows.Forms.Cursors.Default
        Me.btAbrir.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.btAbrir.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btAbrir.ForeColor = System.Drawing.Color.Navy
        Me.btAbrir.Location = New System.Drawing.Point(8, 160)
        Me.btAbrir.Name = "btAbrir"
        Me.btAbrir.Size = New System.Drawing.Size(64, 24)
        Me.btAbrir.TabIndex = 0
        Me.btAbrir.Text = "Abrir"
        Me.ToolTip1.SetToolTip(Me.btAbrir, "Abrir archivo")
        '
        'btNext
        '
        Me.btNext.BackColor = System.Drawing.SystemColors.Control
        Me.btNext.Cursor = System.Windows.Forms.Cursors.Default
        Me.btNext.Enabled = False
        Me.btNext.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.btNext.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btNext.ForeColor = System.Drawing.Color.Navy
        Me.btNext.Location = New System.Drawing.Point(224, 160)
        Me.btNext.Name = "btNext"
        Me.btNext.Size = New System.Drawing.Size(64, 24)
        Me.btNext.TabIndex = 3
        Me.btNext.Text = "Next"
        Me.ToolTip1.SetToolTip(Me.btNext, "Canción siguiente")
        '
        'btPrev
        '
        Me.btPrev.BackColor = System.Drawing.SystemColors.Control
        Me.btPrev.Cursor = System.Windows.Forms.Cursors.Default
        Me.btPrev.Enabled = False
        Me.btPrev.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.btPrev.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btPrev.ForeColor = System.Drawing.Color.Navy
        Me.btPrev.Location = New System.Drawing.Point(80, 160)
        Me.btPrev.Name = "btPrev"
        Me.btPrev.Size = New System.Drawing.Size(64, 24)
        Me.btPrev.TabIndex = 1
        Me.btPrev.Text = "Prev"
        Me.ToolTip1.SetToolTip(Me.btPrev, "Canción anterior")
        '
        'PictureBox3
        '
        Me.PictureBox3.BackColor = System.Drawing.Color.Transparent
        Me.PictureBox3.Image = CType(resources.GetObject("PictureBox3.Image"), System.Drawing.Image)
        Me.PictureBox3.Location = New System.Drawing.Point(312, 72)
        Me.PictureBox3.Name = "PictureBox3"
        Me.PictureBox3.Size = New System.Drawing.Size(112, 48)
        Me.PictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.PictureBox3.TabIndex = 13
        Me.PictureBox3.TabStop = False
        Me.ToolTip1.SetToolTip(Me.PictureBox3, "Utiliza el control ActiveX de Windows Media 9")
        '
        'lbTotal
        '
        Me.lbTotal.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.lbTotal.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lbTotal.ForeColor = System.Drawing.Color.Green
        Me.lbTotal.Location = New System.Drawing.Point(112, 136)
        Me.lbTotal.Name = "lbTotal"
        Me.lbTotal.Size = New System.Drawing.Size(56, 16)
        Me.lbTotal.TabIndex = 8
        Me.lbTotal.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.ToolTip1.SetToolTip(Me.lbTotal, "Duración total de la canción")
        '
        'lbTime
        '
        Me.lbTime.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.lbTime.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lbTime.ForeColor = System.Drawing.Color.Green
        Me.lbTime.Location = New System.Drawing.Point(320, 136)
        Me.lbTime.Name = "lbTime"
        Me.lbTime.Size = New System.Drawing.Size(64, 16)
        Me.lbTime.TabIndex = 10
        Me.lbTime.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.ToolTip1.SetToolTip(Me.lbTime, "Tiempo de reproducción")
        '
        'Timer1
        '
        '
        'lbtotal1
        '
        Me.lbtotal1.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.lbtotal1.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lbtotal1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lbtotal1.Location = New System.Drawing.Point(8, 136)
        Me.lbtotal1.Name = "lbtotal1"
        Me.lbtotal1.Size = New System.Drawing.Size(96, 16)
        Me.lbtotal1.TabIndex = 7
        Me.lbtotal1.Text = "Duración total:"
        Me.lbtotal1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'lbTime1
        '
        Me.lbTime1.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.lbTime1.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lbTime1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lbTime1.Location = New System.Drawing.Point(184, 136)
        Me.lbTime1.Name = "lbTime1"
        Me.lbTime1.Size = New System.Drawing.Size(128, 16)
        Me.lbTime1.TabIndex = 9
        Me.lbTime1.Text = "Tiempo transcurrido:"
        Me.lbTime1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'ToolTip1
        '
        Me.ToolTip1.AutomaticDelay = 1000
        Me.ToolTip1.AutoPopDelay = 3000
        Me.ToolTip1.InitialDelay = 1000
        Me.ToolTip1.ReshowDelay = 1000
        '
        'frmPlayer
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(438, 192)
        Me.Controls.Add(Me.lbTime1)
        Me.Controls.Add(Me.lbtotal1)
        Me.Controls.Add(Me.lbTime)
        Me.Controls.Add(Me.lbTotal)
        Me.Controls.Add(Me.PictureBox3)
        Me.Controls.Add(Me.btPrev)
        Me.Controls.Add(Me.btNext)
        Me.Controls.Add(Me.btAbrir)
        Me.Controls.Add(Me.btCerrar)
        Me.Controls.Add(Me.PictureBox1)
        Me.Controls.Add(Me.btStop)
        Me.Controls.Add(Me.btPlay)
        Me.Controls.Add(Me.Panel2)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frmPlayer"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
        Me.Text = "MP3 | M3U | WPL"
        CType(Me.ocxPlayer, System.ComponentModel.ISupportInitialize).EndInit()
        Me.Panel2.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private tiempo As DateTime ' para el tiempo transcurrido

    Private Sub frmPlayer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Top = 150 ' posición y del formulario
        ' posición x del formulario: centrado horizontalmente en la pantalla
        Me.Left = (Screen.PrimaryScreen.WorkingArea.Width - Me.Width) \ 2
        'Dim ruta As String = "D:\Documentos\Emilio.m3u"
        Dim ruta As String = "D:\DOCUMENTOS\Mi Música\My Playlists\Emi.wpl"
        ocxPlayer.URL = ruta
    End Sub

    ' Para abrir el cuadro de diálogo
    Private Sub btAbrir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btAbrir.Click
        abrirArchivo()
    End Sub

    ' Mostrar información de la canción al cambiar el estado del reproductor (PlayStateChange)
    ' al tener inicio automático, simplemente con elegir un archivo ya cambia el estado de reproducción
    Private Sub ocxPlayer_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles ocxPlayer.PlayStateChange
        tiempo = DateTime.Now ' para empezar a contar el tiempo
        ' vaciar la información de la canción anterior
        lbTitulo.Text = ""
        lbTituloa.Text = "Reproducción en curso:"
        lbAutor.Text = ""
        lbAutora.Text = "Intérprete:"
        ' dependiendo del estado del reproductor
        Select Case e.newState
            Case WMPLib.WMPPlayState.wmppsPlaying ' si reproduciendo
                btAbrir.Enabled = False
                btStop.Enabled = True
                btPlay.Enabled = False
                btPrev.Enabled = True
                btNext.Enabled = True
                lbTituloa.Text = "Reproducción en curso:"
                lbTitulo.Text = ocxPlayer.currentMedia.getItemInfobyType("title", "", 0) ' título
                lbAutora.Text = "Intérprete:"
                lbAutor.Text = ocxPlayer.currentMedia.getItemInfobyType("author", "", 0) ' autor
                ' para mostrar la duración de la canción
                Dim minutos As Integer
                Dim segundos As Integer
                minutos = ocxPlayer.currentMedia.duration \ 60 ' división entera entre la duración en segundos y 60
                ' resto entre la duración total y el resultado de la división entera anterior
                segundos = ocxPlayer.currentMedia.duration - (minutos * 60)
                lbTotal.Text = Format(minutos, "00") & ":" & Format(segundos, "00")
                Timer1.Enabled = True ' iniciar el temporizador para cronometrar la canción
                Timer1.Start()
            Case WMPLib.WMPPlayState.wmppsStopped ' si detenido
                btAbrir.Enabled = True ' activar el botón Abrir
                btStop.Enabled = False ' desactivar botón Stop
                btPlay.Enabled = True ' activar botón Play
                btPrev.Enabled = False
                btNext.Enabled = False
                Timer1.Stop() ' detener temporizador
                Timer1.Enabled = False
                lbTotal.Text = ""
                lbTime.Text = ""
        End Select
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ' Código para el cronómetro del tiempo del programa
        Dim Minutos, Segundos As Integer ' variables para mostrar el tiempo
        ' variable Segundos = diferencia en segundos entre una hora y la hora actual 
        Segundos = DateDiff(DateInterval.Second, tiempo, DateTime.Now)
        Minutos = Segundos \ 60
        Segundos = Segundos - (Minutos * 60) ' para que no supere 59
        ' presentación formateada del tiempo transcurrido
        lbTime.Text = Format(Minutos, "00") & ":" & Format(Segundos, "00")
    End Sub

    ' Botón de Play
    Private Sub btPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btPlay.Click
        ocxPlayer.Ctlcontrols.play() ' reproducir
    End Sub

    ' Para tocar la canción anterior
    Private Sub btPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btPrev.Click
        ocxPlayer.Ctlcontrols.previous() ' anterior
    End Sub

    ' Para tocar la siguiente canción
    Private Sub btNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btNext.Click
        ocxPlayer.Ctlcontrols.next() ' siguiente
    End Sub

    ' Botón que detiene el reproductor
    Private Sub btStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btStop.Click
        ocxPlayer.Ctlcontrols.stop() ' detener reproducción
    End Sub

    ' Para cerrar el formulario
    Private Sub btCerrar_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btCerrar.Click
        Close()
    End Sub

    ' --- PROCEDIMIENTO PARA ABRIR ARCHIVOS WPL, MP3 o M3U

    Private Sub abrirArchivo() ' procedimiento para buscar y abrir un archivo
        ' presentar al usuario un cuadro de diálogo
        Dim openFile As New OpenFileDialog
        ' mostrar solamente archivos M3U y MP3
        openFile.Filter = "Listas de canciones (*.wpl)|*.wpl|Archivos Mpeg Layer 3 (*.mp3)|*.mp3|Listas de canciones (*.m3u)|*.m3u"
        ' si elegimos algún archivo
        If openFile.ShowDialog() = DialogResult.OK Then
            ' abrir el archivo elegido en el reproductor
            ocxPlayer.URL = openFile.FileName
        End If
    End Sub

End Class