Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

(Source, Tut) How to get currently playing artist / song from WinAmp / MediaMonkey

a few months back b4 my old laptop died i was working on a project that would allow me to update my signature with the song info that i was listening to. (dynamic sig). at the end of the day, i got it all working, but there was one part that so simple to do i almost couldent believe that i ws googling how to do it.

Get the song info.

well, after staring at pointless vb6 code that used alot of api's (find window....ect) i decided to update the whole mess that everyone had posted and do it up in pure .net.

here we go...

[Image: attachment.php?aid=901]


from there i could simply upload the string to my host and generate the image with the string.
but anyway, thats for another day, lets look at how to get that info.

From doing a bit of googling i found out that there was just a few ways that would work, the first was simply making a plugin that would export the info. The problem with this is that, (in short) my delphi skills suck. The other option (which was the most popular) is to simply grab the window title, so lets do that.

Code
Public Class Form1

    Dim WithEvents tTimer As New Timer
    Dim Last As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  tTimer.Interval = 100
  tTimer.Start()
    End Sub

    Dim cur As String
    Private Sub tTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tTimer.Tick
  cur = FindProcessTitle("mediamonkey")
  If cur IsNot Nothing And cur.Length > 10 Then
    If Not Last = cur Then
    Last = cur
    ListView1.Items.Insert(0, New ListViewItem With {.Text = cur})
    ListView1.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.ColumnContent)
    End If
  End If
    End Sub

    Function FindProcessTitle(ByVal processName As String) As String
  If Process.GetProcessesByName(processName)(0) IsNot Nothing Then
    Return Process.GetProcessesByName(processName)(0).MainWindowTitle
  Else
    Return Nothing
  End If
    End Function
End Class

Pow!

ok, lets walk through there

declare a new timer (yeah yeah, blah blah threads, a timer works just fine)

when the form loads, start the timer
when the timer ticks simply use the function to get the window title and check it aginst the previous one to see if it changed i set it to check the length also because i was getting a single char blank string.
then simply insert it at the top of the listview.

the great thing about this is that it works even when my media player is minimized.

so, there we go...
go have some fun.
(Dec 10, 2011 08:46 AM)Duker Wrote:  nathan72389, can you reply to my thread about the proxy checker, i cant send you pm, you must blocked me before or something

This is completely off-topic and impertinent. I understand that you may need help with something, but posting in a thread without any regard for what the posts actual topic is just makes you look low-quality and makes you look like a bad member. Just saying.

@OP Very useful! Do you know of a way to get the same result with the Zune software? If you could that, I would be completely mesmerized and amazed.
(Dec 10, 2011 09:12 AM)ᒪeumonic Wrote:  This is completely off-topic and impertinent. I understand that you may need help with something, but posting in a thread without any regard for what the posts actual topic is just makes you look low-quality and makes you look like a bad member. Just saying.

@OP Very useful! Do you know of a way to get the same result with the Zune software? If you could that, I would be completely mesmerized and amazed.
If the Windows Title of Zune is also always the Artist + Title all you got to do is replace cur = FindProcessTitle("mediamonkey") with cur = FindProcessTitle("zune") (or what ever the process name of zune is ^^)
Yes well as i have been getting help from nathan and i cannot message him so i thought of posting a message here
(Dec 10, 2011 09:19 AM)pr0t0typ3 Wrote:  If the Windows Title of Zune is also always the Artist + Title all you got to do is replace cur = FindProcessTitle("mediamonkey") with cur = FindProcessTitle("zune") (or what ever the process name of zune is ^^)

True. I feel like a moron for not seeing that.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by HackooMay 6, 2021 05:34 AM 4 256 May 6, 2021 05:34 AM
Last Post: VUEDUE
[.NET] by requiredhqSep 2, 2020 11:37 AM 23 652 Sep 2, 2020 11:37 AM
Last Post: fisica638
[.NET] by hipioJun 19, 2015 07:57 PM 18 266 Jun 19, 2015 07:57 PM
Last Post: idb.