Click here to Skip to main content
15,886,067 members
Articles / Programming Languages / C#
Article

Set Your MSN Live Messenger to Auto Reply

Rate me:
Please Sign up or sign in to vote.
3.87/5 (8 votes)
26 Jan 20073 min read 67K   389   29   9
What if one is getting angry when sending you IMs but not getting any Response. If he/she got patience , then you are safe. But there could be a punch for you on next DATE. Why spoil your DATE. Just go on installing this "AutoReplyAddIn".

Introduction

Customizing MSN Live Messenger to fullfill one's requirement is a great idea. Micosoft offer great Add-In feature to write the Add-Ins for your MSN Live Messenger. Writing an Add-in with Dot.Net Framework 2.0 is just a piece of Cake. So why dont try eating it. Tell me after eating that it was delicious.....ammm..

There are three steps to consider for watching your Add-In working.

  1. Enabling Live Messenger to accept Add-Ins
  2. Writing your Add-In
  3. Registering Add-In with Messenger

Enabling Live Messenger to Accept Add-Ins

hey dont worry, this is also an easy step.

Just follow the instructions

Run your Registry Editor

Start--> Run--> Regedit

Scroll to following Registry KeyHKEY_CURRENT_USER\Software\Microsoft\MSNMessenger

create a new DWORD entry AddInFeatureEnabled, if it is not there. then set its value to 1.

Now restart your Messenger

Writing Add-In

Create a new C# or whatever .Net language you like.

File--> New--> Project-->Class Library

Now Add Reference to MessengerClient.dll

Right Click on your Solution Name-->Add Refrence

Browse for MessengerClient.dll (most probably at C:\Program Files\MSN Messenger )

Now to avoid fully qualified names of types that we are going to use , you should add

using

The next step is to go on writing a class named AddIn(You can choose whatever name you like). But mind one thing that this class should me implementing an Interface

{

User userFrom = e.UserFrom;

Client.SendNudgeMessage(userFrom);

Client.SendTextMessage(

}

"Hey, I m busy. Please leave your message ", userFrom);

Now just build or compile your solution. This will create a dll called your_namespace_name.dll in bin folder of your application. Just browse to that folder and rename that dll. to

your_namespace_name.yourClassName.dll

Now your done with all the Code effort.

Registering your Add-In to Live Messenger

Open up your Live Messenger

Tools--> Options, Your will have an Add-In option click it and browse to your dll created in above steps.

Run Messenger and get your Add-In working.

NOTE: This Article just gives an idea about working with Add-Ins for Windows Live Messenger. A thorough understanding of of Windows Live Messenger Add-In API can be found at http://msdn2.microsoft.com/en-us/library/aa905655.aspx

Here is the complete listing of Code

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Messenger;


namespace

AutoReplyAddIn
{public class AddIn:IMessengerAddIn
{private MessengerClient client = null;public void Initialize(MessengerClient messenger)
{ // Initialize your Add-in hereClient = messenger;// Set Add-in properties here//////////////////////////////////////////////////Client.AddInProperties.Creator = "Shehzad Ahmed"; Client.AddInProperties.Description = "An Add-in to send Auto Replies"; Client.AddInProperties.FriendlyName = "Auto Reply Add-In"; Client.AddInProperties.PersonalStatusMessage = "Auto Reply Add-in Activated";Client.AddInProperties.Status = UserStatus.Online; // Register Handler for Incoming Text MessagesClient.IncomingTextMessage+=new ventHandler<IncomingTextMessageEventArgs> (Client_IncomingTextMessage);
}public void Client_IncomingTextMessage(Object Sender, IncomingTextMessageEventArgs e)
{User userFrom = e.UserFrom;Client.SendNudgeMessage(userFrom);
Client.SendTextMessage("Hey, I m busy. Please leave your message ", userFrom);
}public MessengerClient Client
{get{ return client; }private set{
client = value;
}
}
}
}

IMessengerAddIn

public class AddIn:IMessengerAddIn

IMessengerAddIn offers Initialize Method that must be implemented.

public

Since we are aiming to send only an Auto Reply, we just need register with the

IncomingTextMessage event as new EventHandler<IncomingTextMessageEventArgs>(Client_IncomingTextMessage);

Client.IncomingTextMessage+=

Now just go on writing Event Handler

public

void Client_IncomingTextMessage(Object Sender, IncomingTextMessageEventArgs e) void Initialize(MessengerClient messenger){} Microsoft.Messenger

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Pakistan Pakistan
Shehzad Ahmed, Software Developer, Domains C#, VB.NET and ASP.Net

Comments and Discussions

 
Generaladult content filter. - protecting my kids Pin
ZUPERKOOL7-Feb-10 5:01
ZUPERKOOL7-Feb-10 5:01 
GeneralMessenger 9 Pin
PeaceTiger16-Apr-09 4:25
PeaceTiger16-Apr-09 4:25 
QuestionStatusChangedEvent Pin
plextoR5-Jul-07 8:15
plextoR5-Jul-07 8:15 
Questionwhat about C++? Pin
Amro Ibrahim21-Feb-07 4:02
Amro Ibrahim21-Feb-07 4:02 
GeneralThis is not C++... Pin
toxcct20-Feb-07 8:55
toxcct20-Feb-07 8:55 
GeneralNice Article Pin
Ckesri10-Feb-07 12:13
Ckesri10-Feb-07 12:13 
GeneralDownload breaks... Pin
Dandy Cheung29-Jan-07 15:19
Dandy Cheung29-Jan-07 15:19 
GeneralRe: Download breaks... Pin
Member 363273930-Jan-07 18:15
Member 363273930-Jan-07 18:15 
GeneralGreat article Pin
Bradml26-Jan-07 20:59
Bradml26-Jan-07 20:59 

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

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