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 ;-), but did you know that you can create a plug-in for it, as well? Well, you do now :-).
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!
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)
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)
if (e.TextMessage.Contains("porn") ||
String caption = "WARNING";
StringBuilder textMessage = new StringBuilder();
textMessage.Append("MESSAGE TO ALL PEOPLE AROUND:\n");
textMessage.Append(" is sending PORN to this nice little nerd!!!");
for (int i = 0; i < 10; i++)
" 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.
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.
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... :-) All that because I don't tell them. Muahahaha, I AM SO EVIL.
- 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