Mess with Messenger gets the scoop on building Addins for Live Messenger

Mess with Messenger gets the scoop on building Addins for Live Messenger

Anyone who is part of the Live Messenger Beta (ideas.live.com) and is interested in building managed addins for Live Messenger should head over to the Mess with Messenger website.  They have managed to get hold of build 8.0.0683 which includes a special tab for Addins under Tools–>options (samples etc are also available from their website).


By default the Addins tab is missing, so you have to enable it via a registry key:


[HKEY_CURRENT_USERSoftwareMicrosoftMSNMessenger]
“AddInFeatureEnabled”=dword:00000001


Once enabled, the Addins tab should appear (you will need to exit and restart Live Messenger) after you have signed in.


The next thing you have to do is to build your Live Messenger Addin.  This is relatively easy as there is now a MessengerClient.dll in the application folder for Live Messenger (eg c:Program FilesMSN Messenger).  This is a managed wrapper dll which you need to reference in your addin.


So in summary to create your addin you create a class library project (VB.NET, C# or any other .NET language) and you use Add Reference to select the MessengerClient.dll. You then need to create your addin class with which to access the api though.  This class is called by Messenger when your addin is initialized so it MUST be named the same as your class library (just without the dll).  Do NOT put it in a namespace or it will not be found (for VB.NET developers this means you have to remove the default namespace). This class also must implement the IMessengerAddIn interface (which is in the Microsoft.Messenger namespace – I found it easier just to import this namespace).


Implementing this interface requires the Initialize method into which an instance of the MessengerClient class is passed.  I would suggest holding a reference to this class as you can attach handlers so that you can invoke your code when certain actions/events occur.  The following code is a quick Addin I wrote that shows how you can have event handlers for the various Messenger events.  Note that this is compiled into NickSampleLiveAddin.dll


Imports Microsoft.Messenger


Public Class NickSampleLiveAddin
    Implements IMessengerAddIn


    Private theMessenger As MessengerClient


    Public Sub Initialize(ByVal messenger As Microsoft.Messenger.MessengerClient) Implements Microsoft.Messenger.IMessengerAddIn.Initialize
        Me.theMessenger = messenger


        Me.theMessenger.AddInProperties.Creator = “Nick Randolph @ SoftTeq”
        Me.theMessenger.AddInProperties.Description = “Sample plugin!”
        Me.theMessenger.AddInProperties.FriendlyName = “SoftTeq Addin”
        Me.theMessenger.AddInProperties.PersonalStatusMessage = “Nick’s working on an Addin….”
        Me.theMessenger.AddInProperties.Status = UserStatus.Busy
        Me.theMessenger.AddInProperties.UserTile = My.Resources.Nick
        Me.theMessenger.AddInProperties.Url = New Uri(“
https://blogimages.builttoroam.com/nick“)



        ‘AddHandler Me.theMessenger.StatusChanged, AddressOf OnStatusChanged
        ‘AddHandler Me.theMessenger.Shutdown, AddressOf OnShutdown
        ‘AddHandler Me.theMessenger.ShowOptionsDialog, AddressOf OnShowOptionsDialog
        ‘AddHandler Me.theMessenger.OutgoingTextMessage, AddressOf OnOutgoingTextMessage
        ‘AddHandler Me.theMessenger.IncomingTextMessage, AddressOf OnIncomingTextMessage
    End Sub


End Class



Once you have create and compiled your Addin you can go back to Live Messenger and select it in the Addins tab.  In order to debug your Addin you can simply attach Visual Studio to the messenger process (msnmsgr.exe) and go ahead and set breakpoints.


Oh, a couple of last things about Addins:  Live Messenger only seems to be able to run 1 Addin at a time – kind of sux really, hopefully they will change this.  Addins also run in a tight security sandbox, so if you were hoping to do malicious things, think again. Lastly, when an Addin is running you get a message at the top of your messenger windows saying that the Addin is running.


Happy Messengering…

Leave a Reply

Your email address will not be published. Required fields are marked *