-   
- Option Explicit 
- Option Base 1 
- Dim Tapa As Integer 
- Dim creditos As Integer 
- Dim Pasa_Pago As Boolean 
-   
- ' Carga las tapas de los albunes 
-   
- Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) 
- On Error GoTo err 
-     cargaTemas Adodc1.Recordset!nalbum 
-     If Dir("c:\mp3\imagenes\" & Adodc1.Recordset!nalbum & ".jpg") <> "" Then 
-         PicTapa.Picture = LoadPicture("c:\mp3\imagenes\" & Adodc1.Recordset!nalbum & ".jpg") 
-     Else 
-         PicTapa.Picture = LoadPicture("c:\mp3\imagenes\noimage.jpg") 
-          
-     End If 
- err: 
- End Sub 
-   
- Private Sub cmdAdelante_Click() 
- If Adodc1.Recordset.Bookmark <> Adodc1.Recordset.RecordCount Then 
-     Adodc1.Recordset.MoveNext 
-      
- End If 
- End Sub 
-   
- Private Sub cmdAtras_Click() 
- If Adodc1.Recordset.Bookmark > 1 Then 
-     Adodc1.Recordset.MovePrevious 
-      
- End If 
- End Sub 
-   
- Private Sub cmdCreditos_Click() 
- End Sub 
-   
- Private Sub Form_KeyPress(keyascii As Integer) 
- Dim nT As Integer 
- Dim R As Integer 
- Select Case keyascii 
-    Case Asc("0") 
-      
-     If List3.ListCount > 0 Then 
-         Pasa_Pago = True 
-         Mp1.Stop 
-         Mp1.Open "c:\mp3\" & List3.ItemData(0) & ".mp3" 
-         Mp1.Volume = -10 
-         Graba_tema List3.ItemData(0) 
-         List3.RemoveItem (0) 
-     Else 
-         Pasa_Pago = False 
-         RandTema 
-     End If 
-   
-     Case Asc("6") 
-         cmdAdelante_Click 
-     Case Asc("4") 
-         cmdAtras_Click 
-     Case Asc("2") 
-         If List1.ListCount - 1 <> List1.ListIndex Then 
-             List1.ListIndex = List1.ListIndex + 1 
-         End If 
-     Case Asc("8") 
-         If List1.ListIndex > 0 Then 
-             List1.ListIndex = List1.ListIndex - 1 
-         End If 
-     Case Asc("5") 
-     [COLOR=red]        If creditos = 0 Then 
-             frametop10.Visible = True 
- cargaadodc Adodc1, "SELECT TOP 10 Tema, Autor, NúmeroDeDuplicados FROM Reproducidos ORDER BY NúmeroDeDuplicados DESC;" 
-                 For R = 0 To 9 
-                         Label10(R).DataField = “” 
-                         Label11(R).DataField = “” 
-                 Next R 
-             End If[/COLOR] 
-          
-         If List1.ListIndex <> -1 Then 
-             If creditos > 0 Then 
-                 List2.AddItem Label3(0).Caption & " - " & List1.Text 
-                 List2.ItemData(List2.NewIndex) = List1.ItemData(List1.ListIndex) 
-                 creditos = creditos - 1 
-                 Label1.Caption = creditos 
-             End If 
-                 If List2.ListCount > 0 Then 
-                     ''''frmMP3Play.Show ''1 
-                     For nT = 0 To List2.ListCount - 1 
-                         List3.AddItem List2.List(nT) 
-                         List3.ItemData(List3.NewIndex) = List2.ItemData(nT) 
-                     Next 
-                         List2.Clear 
-                         Pasa_Tema 
-                 End If 
-         End If 
-             
-      Case Asc("9") '''moneda 
-             frametop10.Visible = False 
-             creditos = creditos + TemXcre 
-             Label1.Caption = creditos 
-     Case Asc("7") 
-         If InputBox("Cierra") = "77" Then ShutdownSystem EWX_POWEROFF 
-    
-     Case vbKeyEscape 
-         End 
- End Select 
- End Sub 
-   
- Private Sub Form_Load() 
- frametop10.Visible = False 
- Pasa_Pago = False 
- cargaadodc Adodc1, "SELECT Albumes.ID_Album as nalbum, Albumes.Album, Albumes.id_autor, Albumes.Genero, Autores.Autor FROM Autores INNER JOIN Albumes ON Autores.ID_Autor = Albumes.id_autor ORDER BY Genero,Autores.Autor;" 
-    'Load Form2 
-     WndShow1.WindowHandle = frmSeleccionTemas.hWnd 
-     WndShow1.Show 
- creditos = 0 
- Label1.Caption = creditos 
- Label7.Caption = IIf(TemXcre = 1, "1 Moneda = 1 Tema/s", "1 Moneda = " & TemXcre & " Temas/s") 
- Mp2.FileName = App.Path & "\vidfon.wmv" 
- Me.Width = Screen.Width 
- Me.Height = Screen.Height 
- End Sub 
-   
- Private Sub Mp1_EndOfStream(ByVal Result As Long) 
- pasa_siguiente 
- End Sub 
-   
- ' Carga temas Albunes 
-   
- Private Function cargaTemas(ndisco) 
- Dim Reco As ADODB.Recordset 
- Dim nv 
- Set Reco = New ADODB.Recordset 
- Reco.Open "select * from temas where id_album = " & ndisco & " order by id_tema", Constri, adOpenStatic, adLockReadOnly 
- nv = 1 
- If Reco.RecordCount <> 0 Then 
- List1.Clear 
-     Do While Not Reco.EOF 
-         List1.AddItem Format$(nv, "00") & " - " & Reco!Tema 
-         List1.ItemData(List1.NewIndex) = Reco!Id_Tema 
-         nv = nv + 1 
-     Reco.MoveNext 
-     Loop 
- End If 
- Reco.Close 
- End Function 
-   
- Private Sub Pasa_Tema() 
-   
- If Pasa_Pago = False Then 
-     If List3.ListCount > 0 Then 
-        ' Mp3.Command = "Stop" 
-         Pasa_Pago = True 
-         Mp1.Stop 
-         Mp1.Open "c:\mp3\" & List3.ItemData(0) & ".mp3" 
-         Mp1.Volume = -50 
-         Graba_tema List3.ItemData(0) 
-         List3.RemoveItem (0) 
-     Else 
-         Pasa_Pago = False 
-         RandTema 
-     End If 
- End If 
-   
- End Sub 
- Private Sub pasa_siguiente() 
- Label8(0).Caption = "" 
- Label8(1).Caption = "" 
-   
-        If List3.ListCount > 0 Then 
-         Pasa_Pago = True 
-         Mp1.Stop 
-         Mp1.Open "c:\mp3\" & List3.ItemData(0) & ".mp3" 
-         Mp1.Volume = -10 
-         Graba_tema List3.ItemData(0) 
-         List3.RemoveItem (0) 
-     Else 
-         Pasa_Pago = False 
-         RandTema 
-     End If 
-   
- End Sub 
- Private Sub RandTema() 
- Dim rec1 As ADODB.Recordset 
- Dim Ntemas As Integer 
- Dim nroTem As Integer 
- Dim rn 
- Label8(0).Caption = "" 
- Label8(1).Caption = "" 
- 'Label8(2).Caption = "" 
-   
- Pasa_Pago = False 
- Set rec1 = New ADODB.Recordset 
- rec1.Open "select * from temas", Constri, adOpenStatic, adLockReadOnly 
- Ntemas = rec1.RecordCount 
- Randomize 
- rn = Int((Ntemas * Rnd))   ' Genera valores aleatorios entre 1 y 6. 
- 'rn = Int(Ntemas / 60 * Second(Time)) 
- rec1.MoveFirst 
- rec1.Move rn 
- nroTem = rec1(0) 
- rec1.Close 
- Set rec1 = Nothing 
- Mp1.Stop 
- TMRTema.Enabled = True 
- Mp1.Volume = -2700 
- Mp1.Open "c:\mp3\" & nroTem & ".mp3" 
-   
- End Sub 
-   
- Private Sub tmrPasa_Timer() 
- tmrPasa.Enabled = False 
- pasa_siguiente 
- End Sub 
-   
- Private Function Graba_tema(nTem As Integer) 
- Dim con As ADODB.Connection 
- Dim rec1 As ADODB.Recordset 
- Set con = New ADODB.Connection 
- Set rec1 = New ADODB.Recordset 
- rec1.Open "SELECT Temas.Tema, Autores.Autor FROM Autores INNER JOIN (Albumes INNER JOIN Temas ON Albumes.ID_Album = Temas.Id_album) ON Autores.ID_Autor = Albumes.id_autor WHERE (((Temas.Id_Tema)=" & nTem & "));", Constri, adOpenStatic, adLockReadOnly 
-     If rec1.RecordCount <> 0 Then 
-         Label8(0).Caption = rec1(0) 
-         Label8(0).Refresh 
-         Label8(1).Caption = rec1(1) 
-         Label8(1).Refresh 
-                  
-     End If 
-   
- rec1.Close 
- con.Open Constri 
- con.Execute "insert into reproducciones (id_tema) values (" & nTem & ")" 
- con.Close 
- Set con = Nothing 
- End Function 
-   
- Private Sub TMRTema_Timer() 
- Label4.Caption = Mp1.CurrentPosition 
- If Pasa_Pago = False Then 
-     If Mp1.CurrentPosition > 40 Then 
-         Mp1.Stop 
-         pasa_siguiente 
-       '  TMRTema.Enabled = False 
-     End If 
- End If 
- End Sub 
-   
-   
-