How to change your MSN Display Picture to iTunes’ Current Playing Album Art
Update: If you'd rather just download a program instead of writing your own to do this for you, take a look at CD Art Display. It's free to download, and will do even more than just show album art in your msn profile picture.
This little howto is actually quite involved. I wasn't quite sure what was possible with the new Live Messenger Addin capability, but as it turns out, it is quite difficult to bypass some of the barriers set up by the addin technology. If you are really intent on getting this set up, or are just curious about what I did to get it going, feel free to read on.
A note to those who aren't interested in the programming side of this post: I'll post the files you need to download throughout the howto, but these files are not really recommended for everyday use. The actual solution I've come to is a pretty odd workaround, though it does work, so feel free to give it a try if you're brave. You'll need to go through each step, but you can just download the files for #1 and #4.
What you'll need:
-some knowledge of VB.Net and a visual studio version with vb.net
-itunes 7.x
-a bit of free time
Step 1: Set up Live Messenger to allow Addins
The new Live Messenger does have addin capabilities built in, but they are not enabled by default (they're in beta I guess). To enable addins, you'll have to edit your messenger registry entries. Go to Run, type "regedit" and hit enter. then browse to "HKEY_CURRENT_USER\Software\Microsoft\MSNMessenger" and add a "DWORD" entry called "AddInFeatureEnabled" and change it's value to 1. Now restart your Live Messenger and go to Options. There should be a tab called "Add-ins". You're Messenger is all set to go.
Step 2: Write your .dll file for the Addin
Open up visual studio and start a new Class Library. You'll want to set up the project name right away, since your Class name has to be the same as the assembly name. Make sure your root namespace is empty. Add the MessengerClient.dll reference (browse to C:\Program Files\Windows Live\Messenger). Then you'll want to go through and look at this code (download the .dll here):
Imports Microsoft.MessengerPublic Class MessengerAddin '<- *Important* this is your assembly name!! Implements IMessengerAddIn Public theMessenger As MessengerClientPublic Sub Initialize(ByVal messenger As Microsoft.Messenger.MessengerClient)Implements Microsoft.Messenger.IMessengerAddIn.InitializeMe.theMessenger = messenger Me.theMessenger.AddInProperties.Creator = "SkyCapitan" Me.theMessenger.AddInProperties.Description = "iTunes Art plugin!" Me.theMessenger.AddInProperties.FriendlyName = "SkyCapitan's Addin" Me.theMessenger.AddInProperties.PersonalStatusMessage = TimeOfDay & " - Sky's not listening to music...." Me.theMessenger.AddInProperties.Url = New Uri("http://svankruistum.com")Dim systime As New System.Timers.Timer() systime.Interval = 5000 'This will check our config file every 5 seconds to see if the track has changed systime.Enabled = True AddHandler systime.Elapsed, AddressOf OnTimedEventEnd Sub Public Sub OnTimedEvent()On Error Resume Next 'in case the config file is not "0" or an artist_ or album combination Dim tempin As String Dim jpeg As String Dim oRead As System.IO.StreamReader Dim oWrite As System.IO.StreamWriteroRead = New System.IO.StreamReader("C:\art\config.txt") tempin = oRead.ReadLineIf tempin = "0" ThenoRead.Close() 'Nothing new we have to doElsejpeg = tempin 'Change the picture Me.theMessenger.AddInProperties.UserTile = System.Drawing.Image.FromFile("C:\art\" & jpeg & ".jpg") oRead.Close() 'Change the config file back to "0" oWrite = New System.IO.StreamWriter("C:\art\config.txt") oWrite.Write("0") oWrite.Close()End IfEnd SubEnd Class
A large part of this code is courtesy of a blog post at Nick's .NET Travels, found here. His example sets up a few other Messenger Events that you might like to explore. There is a lot of opportunity for some interesting addins.
The addin should be operational at this point, but another problem lies with MSN's strict sandbox for addins...
Step 3: Set up your MessengerAddin.dll to allow the System reference
The code above needs to access the system namespace for a few reasons: get the art file, check the config file, and use the system timer. Due to the sandbox restrictions in place by MSN Messenger, we need to register the addin on our system.
To do this, first you must sign your file. This is done under Project Properties -> signing. Sign the addin and add a password of your choice.
Next, you'll need to save and build the class library. Then browse to the location of the built .dll file. Now you need to drag and drop the file into your C:\WINDOWS\assembly folder.
Open up MSN, and try enabling your addin. Everything should work (though you don't have the artwork and the appropriate config file yet).
Step 4: Create a program to save your artwork and config file
After creating a few past itunes programs, I just had to edit a few lines in my itunes displayer program. If you don't want to create your own program, here is an adjusted version of itunes_displayer for you to run. This isn't really ideal, since a popup jumps up every track change, etc. here's some code (it's vb6, not vb.net) that might help you to set it up:
'Declarations
'Allows us to communicate with the running iTunes application
Dim WithEvents iTunes As iTunesApp
Dim Track As iTunesLib.IITTrack'iTunes play event
Private Sub iTunes_OnPlayerPlayEvent(ByVal iTrack As Variant)'Find the current track
Set Track = iTunes.CurrentTrackDim Art1 As iTunesLib.IITArtworkCollection
Dim Art2 As iTunesLib.IITArtwork
Set Art1 = Track.ArtworkIf Art1.Count > 0 Then
Set Art2 = Art1.Item(1)
Art2.SaveArtworkToFile ("C:\art\" & Track.Artist & " - " & Track.Album & ".jpg")
Open "C:\art\config.txt" For Output As #5
Print #5, Track.Artist & " - " & Track.Album
Close #5End If
End Sub
Either way, you'll need the artwork and the config file one way or another.
Now all you need to do is run the itunes_displayer program (or your own alternative), and then enable the addin! Hope it works out for you!
A few notes:
-Your messenger picture does not change in real time for everyone. When you have an active conversation open, the person might see your picture change. If not, it won't always be apparent to others that your picture is changing.
-I had to make all the files and such because despite the signed dll and assembly folder move, the sandbox still doesnt let me open an itunes reference from within the addin. If anyone knows a more efficient way to do this, i'd love to hear it!!
March 9th, 2008 - 15:44
any solution to make it work with WinAMP ?
March 9th, 2008 - 16:23
Well, I’m not really a user of winamp.
however, I have had a quick look at the winamp SDK, and it’s all written for C++, so I don’t think I’d be able to help you out too much from the programming side of things.
If you’re looking for a quick way to get your artwork to change in messenger, I’m pretty sure CD Art Display will do this for both Winamp and iTunes (as well as mediamonkey, foobar2000, and others)
July 25th, 2008 - 07:48
Is there any chance of being able to view the full source code of the itunes_displayer app? im wishing to find some code that is able to retrieve the album artwork from iTunes, but i cant locate it anywhere
Thanks
July 27th, 2008 - 17:23
Nick,
I’m a bit too lazy to go through and make up some source code for the project (it’s old and I’ve given up on the whole idea).
But here’s some of the code that should help you (and perhaps others) get working with itunes and VB (this is in VB6 – sorry for the messy looking code):
‘First, import the reference to ituneslib1.0 (this is important!)
’set up the itunes object (withevents if you’re want to use itunes’ events)
Dim WithEvents iTunes As iTunesApp
Dim Track As iTunesLib.IITTrack
Dim Art1 As iTunesLib.IITArtworkCollection
Dim Art2 As iTunesLib.IITArtwork
‘open itunes if its not already open, and assign it to the itunes object
Set iTunes = New iTunesApp
Set Track = iTunes.CurrentTrack
Set Art1 = Track.Artwork
‘note this is a collection (a track can have more than 1 art piece)
‘i pick art #1 if it’s there
‘this is where it’s trickier – i don’t know if you can transfer the image through from itunes, so I just saved it locally and then re-loaded the saved picture into VB.
If Art1.Count > 0 Then
Image1.Visible = True
Set Art2 = Art1.Item(1)
Art2.SaveArtworkToFile (”C:\art\” & iTunes.CurrentTrack.Artist & ” – ” &_ iTunes.CurrentTrack.Album & “.jpg”)
Image1.Picture = LoadPicture(”C:\art\” & iTunes.CurrentTrack.Artist &_ ” – ” & iTunes.CurrentTrack.Album & “.jpg”)
End If
Hope that helps a bit.
November 30th, 2008 - 10:57
im struck at step 1
i close windows live messenger
i added the D-word and made it 1, i hope (0X00000001 (1)
i close the register edit
i started WLM again, but i can’t see a new tab
what am i doing wrong?
November 30th, 2008 - 17:02
@ Winters:
Can you confirm what version of WLM you are using?
Also, make sure that the registry entry is all spelled correctly. Check this to see what it should look like.
November 30th, 2008 - 17:16
WLM 8.5 (messenger + 4.70, but thats a built-in)
I checked spelling and that’s the same
November 30th, 2008 - 17:32
The version is the same as mine…All I can say is make sure the registry entry is spelled correctly and in the right directory, and try restarting the computer. Failing that, perhaps you’d need to re-install WLM and try again. You may also want to try importing the information as a .reg file as shown here, just to be sure it’s not a registry editor error.
November 30th, 2008 - 18:51
the .reg file worked
and again …
I fail
I opened VS ==> made class libary (does the name of the project need to be MessengerAddin?, or the class itself?) ==> added reference ==> copied the code of step 2 ==> several errors : Implements IMessengerAddIn (for example, last word is underlined)
using visual studio 2005 (version 8.0)
sorry for being a script retard
November 30th, 2008 - 19:39
No problem.
The Project Name and Class Name both need to be MessengerAddin. Go to Project==> properties and change the root namespace to be blank, and the assembly name to be MessengerAddin.
It looks like the line “Implements Microsoft.Messenger.IMessengerAddIn.Initialize” should be alongside the line above it (there should not be a line break there)
Try this updated code.
December 1st, 2008 - 13:35
i tried with the previous code and made a new 1 the new 1 worked better, i only have 3 errors:
Error 1 Method ‘Public Sub OnTimedEvent()’ does not have the same signature as delegate ‘Delegate Sub ElapsedEventHandler(sender As Object, e As System.Timers.ElapsedEventArgs)’.
Error 2 Reference required to assembly ‘System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ containing the type ‘System.Drawing.Image’. Add one to your project.
Error 3 ‘Drawing’ is not a member of ‘System’.
if you don’t know it, I can send the project if you just mail me with your personal address (I have few hours until I go to bed) @ GMT + 1
December 1st, 2008 - 13:41
something that i forgot in previous post does it make any different where the project is located? C:\ or in the my documents/…/projects/
December 1st, 2008 - 19:09
The save location of the project does not matter until you try to load up the .dll file in MSN.
You’ll want to add a reference to System.Drawing if you use that section of the code, though I’m not sure what your first error’s cause would be. Make sure your code that specifies the arguments for systime is correct (that’s what the error seems to be coming from)
February 24th, 2009 - 19:42
Does it work for Windows Live Messenger 2009 14.0.8064.0206 + iTunes 8
???
February 24th, 2009 - 21:46
I have no clue whether it works with WLM 2009. But I will say that if you can enable add-ons (ie. can get to the addon option enabled in WLM), then it should work.
February 25th, 2009 - 07:23
I didn’t try it at the new WLM because I updated it 2 days ago
but I’m gonna try now and post another comment.
February 25th, 2009 - 07:51
mmm the register file was still in WLM but it doesn’t show addons / addins, but i just send a question to WLM help, I let you know what the solution is. Until then.
March 2nd, 2009 - 14:44
I asked WLM for information about it and they said that they didn’t know how to do it and they redirected me to iTunes, but you have to call them and why would they know how you use the add-on in a program from other designers. So sorry for this failure.
March 2nd, 2009 - 23:28
Don’t worry about it, Winters. Sounds like the people who replied don’t know what they’re talking about. I’ve read some online forums just now, and it sounds like the addon feature in WLM 2009 does not work. Sorry to all those who asked about it. I don’t know why they disabled this feature.