Click here to Skip to main content
11,577,710 members (61,695 online)
Click here to Skip to main content

Creating Windows Live Messenger Add-ins

, 21 Jun 2007 BSD 132.4K 542 122
Rate this:
Please Sign up or sign in to vote.
An article on creating MSN 8 plug-ins

Sample image

Introduction

We all know good old MSN and if you are a bit like me, you just love the games like tic-tac-toe and poker. Well, there are many articles that show you how to create new games -- one of them is here -- and there are many articles that show you how to extend your own application (hehehehe MINE ALL MINE !!!!!!!! HAHAHA Wink | ;-) , but did you know that you can create a plug-in for it, as well? Well, you do now Smile | :) .

The reason why most people don't know about this nice feature is because it isn't enabled by default and is intended to get some nice feedback from you: the DEVELOPERS. Now let's get started with that programming!

Background

To really understand this article, you only need to know a few things:

  • How to download MSN Messenger
  • How to use MSN Messenger
  • And how to fool around (Nah, that last one isn't really a requirement)

Getting started

If you want to begin programming your own new feature into MSN, you are going to try and test the plug-in. This will not work. If you remember what I said a few lines back, "It isn't enabled by default." To enable the feature, you must create or adapt a key in your registry: HKEY_CURRENT_USER\SOFTWARE\Microsoft\MSNMessenger\AddInFeatureEnabled must be set to 1. To turn it off, you must delete it or change its value to 0. If you are lazy and don't want to look for the key, just start up LiveMessengerRegistryAdapter.exe. It is a small program that can change the value of the key.

Now if you go and start up your MSN, you should see a new tab in your options dialog: Add-ins. This will be our main entrance into the world of pluggies (I wanted to say fairytales, but it sounded childish). This menu is used to load plug-ins, but it does not activate them. To activate a plug-in you just need to read on.

You are now ready to take on the real challenge: finding something that people can use in their MSN Messenger. I failed in that task; all you will see here are things nobody wants and no one asks for...

Create a Class Library and import a reference to the following library: C:\Program Files\MSN Messenger\MessengerClient.dll. Then create a class with the name of your add-in. Now before we go any further, there is a requirement for an add-in. That is, the assembly name must have a name in the Namespace.ClassName format. This must be the full name of the class that implements the IMessengerAddIn interface. In VS 2005, this is also the project name. This is all because the programmers of the MessengerClient were too lazy to do reflection on the DLL. Instead, they used the DLL name to determine which class inside the assembly to instantiate.

If the name does not match the class name that uses the IMessengerAddIn interface, then you will get a large MessageBox with the message that tells you that it failed to load in the class. This is the tricky part because the hard part is over from the minute you can load the library in your Live Messenger. So, I recommend that you first implement the interface and then test the compiled DLL in your client.

The only real bugger in this feature is that you have to shut down MSN Messenger each and every time you want to rebuild the application.

Using the code

As always, most of my explaining is located inside the code files. However, I will show you the best parts of my add-in. I love this part, as you scan all incoming messages for "dirty" words and then react to the dirty words. It would be easy for you to use a database that is on the other side of the planet and insert all the words in the database...

void Client_IncomingTextMessage(object sender, IncomingTextMessageEventArgs e)
{
    // Checkout the incoming textmessage...
    if (e.TextMessage.Contains("porn") ||
    e.TextMessage.Contains("pron") ||
    e.TextMessage.Contains("porno"))
    {
        String caption = "WARNING";

        StringBuilder textMessage = new StringBuilder();
        textMessage.Append("MESSAGE TO ALL PEOPLE AROUND:\n");
        textMessage.Append(e.UserFrom.Email);
        textMessage.Append(" is sending PORN to this nice little nerd!!!");

        // Alert every person that is standing in the neighbourhood.
        System.Windows.Forms.MessageBox.Show(textMessage.ToString(), caption,
        System.Windows.Forms.MessageBoxButtons.OK,
        System.Windows.Forms.MessageBoxIcon.Exclamation);

        // And make this a noisy message :-)
        for (int i = 0; i < 10; i++)
        {
             System.Media.SystemSounds.Beep.Play();
             System.Media.SystemSounds.Exclamation.Play();
        }

        // And finally warn the other user not to 
        // send porn to this little nerd.
        // Just show him a red text message :-).
        // You could also send him a normal text message using 
        // "Client.SendTextMessage(text, userTo);"
        Client.SendActionMessage(Client.LocalUser.FriendlyName + 
            " is not allowed to receive porn.", e.UserFrom);
    }
}

Well, I really should encourage you to view the code file. It is more comment than code, so don't worry... And I hope this article will get you all started programming features for MSN Live.

Warning

I just went crazy when my plug-in did not work while loaded. The plug-in will only work when you actually activate it manually. This is, of course, after you load the plug-in into the Add-in tab. See the first picture for the Add-in tab.

Sample image

Points of interest

I never knew that you could bug people with a plug-in on MSN. And the people don't know that they can shut this add-in feature off... Smile | :) All that because I don't tell them. Muahahaha, I AM SO EVIL.

History

  • 18 January, 2007 -- Original version posted
  • 6 April, 2007 -- First update
  • 21 June, 2007 -- Article edited and moved to the main CodeProject.com article base

License

This article, along with any associated source code and files, is licensed under The BSD License

Share

About the Author

No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 5 Pin
Member 16167115-Dec-11 22:49
memberMember 16167115-Dec-11 22:49 
Generalbad word filter to protect my kids. with [***********] 's Pin
ZUPERKOOL7-Feb-10 7:30
memberZUPERKOOL7-Feb-10 7:30 
GeneralRe: bad word filter to protect my kids. with [***********] 's Pin
Filip van der Meeren7-Feb-10 10:34
memberFilip van der Meeren7-Feb-10 10:34 
QuestionNo MessengerClient.dll file for WLM 2009? Pin
Onur Guzel29-Jan-10 4:50
memberOnur Guzel29-Jan-10 4:50 
AnswerRe: No MessengerClient.dll file for WLM 2009? Pin
Filip van der Meeren30-Jan-10 1:20
memberFilip van der Meeren30-Jan-10 1:20 
GeneralRe: No MessengerClient.dll file for WLM 2009? Pin
Onur Guzel30-Jan-10 7:07
memberOnur Guzel30-Jan-10 7:07 
GeneralRe: No MessengerClient.dll file for WLM 2009? Pin
Member 468002625-Jul-10 22:47
memberMember 468002625-Jul-10 22:47 
GeneralWindows LIVE messenger Pin
NaNg1524115-May-09 5:10
memberNaNg1524115-May-09 5:10 
QuestionRe: Windows LIVE messenger Pin
Josh Powers20-May-09 13:32
memberJosh Powers20-May-09 13:32 
JokeRe: Windows LIVE messenger Pin
Filip van der Meeren21-May-09 9:59
memberFilip van der Meeren21-May-09 9:59 
I must leave your question open, and should encourage you to google this or put a request on the MSDN site...
That because I have switched platforms about 2 months after this article Laugh | :laugh:

Mac OS X and Suse are my love and passion for the moment.

Don't you also love the code?

GeneralGreat article, sourcecode has a very small bug Pin
Ray Guan16-Nov-08 20:10
memberRay Guan16-Nov-08 20:10 
GeneralRe: Great article, sourcecode has a very small bug Pin
Filip van der Meeren16-Nov-08 21:56
memberFilip van der Meeren16-Nov-08 21:56 
GeneralThanks for sharing! Pin
MarkBrock31-May-08 23:18
memberMarkBrock31-May-08 23:18 
GeneralGrayed Out Pin
sabrown10023-Dec-07 12:45
membersabrown10023-Dec-07 12:45 
GeneralGrayed Out Pin
sabrown10023-Dec-07 12:44
membersabrown10023-Dec-07 12:44 
QuestionStatusChangedEvent Pin
plextoR5-Jul-07 8:12
memberplextoR5-Jul-07 8:12 
QuestionWhat about Installer? Pin
Sameers (theAngrycodeR )30-Jun-07 15:47
memberSameers (theAngrycodeR )30-Jun-07 15:47 
AnswerRe: What about Installer? Pin
Filip van der Meeren30-Jun-07 21:35
memberFilip van der Meeren30-Jun-07 21:35 
GeneralRe: What about Installer? Pin
Sameers (theAngrycodeR )1-Jul-07 5:21
memberSameers (theAngrycodeR )1-Jul-07 5:21 
GeneralRe: What about Installer? Pin
Filip van der Meeren1-Jul-07 7:52
memberFilip van der Meeren1-Jul-07 7:52 
GeneralRe: What about Installer? Pin
sabrown1008-Dec-07 11:48
membersabrown1008-Dec-07 11:48 
QuestionCan I put a timer in the addin ?? Pin
Jason Law28-Jun-07 19:48
memberJason Law28-Jun-07 19:48 
AnswerRe: Can I put a timer in the addin ?? Pin
Filip van der Meeren29-Jun-07 1:38
memberFilip van der Meeren29-Jun-07 1:38 
Generalwhether the plug can send html ? [modified] Pin
flyingchen28-Jun-07 16:46
memberflyingchen28-Jun-07 16:46 
GeneralRe: whether the plug can send html ? Pin
Filip van der Meeren29-Jun-07 1:43
memberFilip van der Meeren29-Jun-07 1:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150603.1 | Last Updated 21 Jun 2007
Article Copyright 2007 by Filip van der Meeren
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid