Windows Live Messenger Add-Ins

Posted on 22 Dec 2006

When software applications do what they are advertised to do users are happy (generally), but what if you want to do more? Thats where you generally start looking for some method to extend the application. Not every application will allow this, but Windows Live Messenger (WLM) is one that does (at least currently with version 8.0). How, you ask? By writing your very own Add-In with the Messenger Add-In API …

WLM only offers this one API (Application Programming Interface), so it’s not like Microsoft Excel where you have a vast array to pick from (i.e. .NET APIs, C APIs, COM Automation, VBA and XLM). You do get to pick a language that supports .NET and then proceed with the following:

  1. Download and install the .Net 2.0 SDK . This is a minimum requirement. You can also use Visual Studio .NET 2005, or Visual Studio Express (which is a free download), both of which come with the .NET 2.0 SDK.
  2. Write your Add-In. Compile and get the DLL. Full instructions, along with the special reg-key to set, and what to call your DLL to make things work are on MSDN .
  3. Add the Add-In to Windows Live Messenger.

The code is simple enough. Below is an example of an Add-In that updates your personal status message every few seconds to show how long you have been online.

using System;
using System.Timers;
using Microsoft.Messenger;
namespace WLM
{
  public class CounterAddIn : IMessengerAddIn
  {
    static MessengerClient m_client;
    static int m_cSeconds;
    Timer m_timer;

    void IMessengerAddIn.Initialize(MessengerClient client)
    {
      m_client = client;
      m_client.AddInProperties.FriendlyName = "CounterAddIn";
      m_cSeconds = 0;
      m_timer = new Timer(3000);
      m_timer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
      m_timer.Enabled = true;
    }

  private static void OnTimedEvent(object source, ElapsedEventArgs e)
  {
    m_cSeconds += 3;
    m_client.AddInProperties.PersonalStatusMessage = "Online for " + m_cSeconds.ToString() + " seconds.";
    }
  }
}

You can also do things such as change your personal image, status, or even respond to users messages (although users always know that the Add-in is running) with automated replies.

One important step is setting the magic registry key such that Messenger lets you add your own custom Add-In. When the key is set correctly Messenger provides controls on its Options page for Add-In support.

Key: HKEY_CURRENT_USER\Software\Microsoft\MSNMessenger\AddInFeatureEnabled

Value: DWORD set to “1” to enable, and “0” to disable Add-Ins.