Results 1 to 22 of 22

Thread: VB6 - Get Winamp 5.xx currently playing module.

Threaded View

  1. #2

    Thread Starter
    Frenzied Member thegreatone's Avatar
    Join Date
    Aug 2003
    Location
    Oslo, Norway. Mhz:4800 x12
    Posts
    1,333

    Re: VB6 - Get Winamp 5.xx currently playing module.

    I mentioned being able to create a decent logfile of your played songs... i gave Pseudo Code, now, i bring to you, and example using the very same module as before

    Here is the code for the main Form, i will comment it and show you what is going on :

    VB Code:
    1. Dim CurrSong As String 'this is where the current song will be stored, it will be used in comparisons later on, and so is important.
    2.  
    3. Private Sub Command1_Click()
    4. If Command1.Caption = "Start Logging Songs" Then 'checks to see the caption of the command button
    5. Command1.Caption = "Stop Logging Songs" 'changes the command buttons caption suitably
    6. Timer1.Enabled = True 'enables the simple timer that will be used to log songs
    7. Else:
    8. Timer1.Enabled = False 'turns the timer off
    9. Command1.Caption = "Start Logging Songs" 'changes the command buttons caption
    10. End If
    11. End Sub
    12.  
    13. Private Sub Command2_Click()
    14. On Error GoTo SAVE_ERROR 'error trapping
    15. Dim intX As Integer
    16. CD.Filter = "Text File (*.txt)|*.txt" 'set the output of the common dialog control to text files
    17. CD.ShowSave 'shows the common dialogs save menu
    18. Open CD.FileName For Output As #2
    19. For intX = 0 To List1.ListCount - 1 'loops through the listbox adding all the items to file
    20.     Print #2, List1.List(intX)
    21. Next
    22. Close #2
    23. Exit Sub
    24. SAVE_ERROR:
    25.     MsgBox Err.Num & " " & Err.Description, vbOKOnly, "" 'tells the end user what the error was
    26. End Sub
    27.  
    28. Private Sub Command3_Click()
    29. List1.Clear 'clears the log of songs
    30. End Sub
    31.  
    32. Private Sub Form_Load()
    33. Call Update 'Calling the update function straight away ensures the program id up-to-date with the currently playing song.
    34. End Sub
    35.  
    36. Function Update()
    37. Label1.Caption = getWinampWindow 'calls the module to gain the currently playing songs title
    38. End Function
    39.  
    40. Private Sub Timer1_Timer()
    41. Timer1.Enabled = False 'turns the timer off, just incase processing this Sub takes longer than expected.
    42. Label1.Caption = getWinampWindow 'updates the Label to display the currently playing song.
    43. CurrSong = getWinampWindow 'updates the currently playing song string via the module
    44. If Left(CurrSong, 9) = "[Opening]" Then CurrSong = Right(CurrSong, Len(CurrSong) - 10) 'strips the [opening] tag that may exist on the song if Winamp is struggling to open a particular file
    45. If List1.ListCount > 0 Then List1.ListIndex = 0
    46. If CurrSong = List1.Text Then 'if the same song is still playing as the last update then skip anything from now, and do not re-add the song to the log
    47. Else:
    48. List1.AddItem CurrSong, 0 'adds the currently playing song to the top of the list
    49. End If
    50. Timer1.Enabled = True 'turns the timer back on, so the process can be repeated again.
    51. End Sub

    The module mentioned is unchanged from the one posted above.
    Enjoy the use of this example

    Edit: Compiled .Exe removed from attachment - Hack
    Attached Files Attached Files
    Last edited by Hack; May 3rd, 2005 at 10:04 AM.
    Zeegnahtuer?

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