As some of you know, there is a COM reference library called 'YahooMessengerLib'. What I have done with it until now was:
- Login with user and password
- Logout
YM must be started for use to use this library.

YahooMessengerLib has a lot of interfaces but I don't know if we can use them. It would be a great deal to be able to get a little more deep in this SO your help will be appreciated by many coders trying to figure this out in C#.

Recommended Answers

All 14 Replies

So... what is your question?

My question is:
How can I program things like: send a message, set my status, avatar, address book, image, etc... ? not just log in and log out.

So... what is your question?

haha. sure i did googled. u didn't ;) . It's API FOR WHAT???? c#? show me that. it's for c++ and java. C# is MANAGED CODE. remember :)

haha. sure i did googled. u didn't ;) . It's API FOR WHAT???? c#? show me that. it's for c++ and java. C# is MANAGED CODE. remember :)

haha. sure i did u didn't, so how do i found this if not:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace msnDesktop
{
   public partial class Form1 : Form
   {
       // create the MSN Messenger API
       MessengerAPI.Messenger MSN = new MessengerAPI.Messenger();

       public Form1()
       {
           InitializeComponent();

           MSN.OnMyStatusChange += new MessengerAPI.DMessengerEvents_OnMyStatusChangeEventHandler(MSN_OnMyStatusChange);
           MSN.OnContactStatusChange += new MessengerAPI.DMessengerEvents_OnContactStatusChangeEventHandler(MSN_OnContactStatusChange);
       }

       private void Form1_Load(object sender, EventArgs e)
       {
           try
           {
               if (MSN.MyStatus != MessengerAPI.MISTATUS.MISTATUS_OFFLINE)
               {
                   label1.Text = MSN.MyFriendlyName.ToString();
                   
                   string dpLocation = this.MSN.get_MyProperty((MessengerAPI.MCONTACTPROPERTY)2).ToString();
                   Bitmap myDisplayPicture = new Bitmap(dpLocation);
                   pictureBox1.Image = myDisplayPicture;

                   

                  MessengerAPI.IMessengerContacts Contactpersonen = (MessengerAPI.IMessengerContacts) MSN.MyContacts;

                   for (int i = 0; i < Contactpersonen.Count; i++)
                   {
                       MessengerAPI.IMessengerContact Contact = (MessengerAPI.IMessengerContact)Contactpersonen.Item(i);

                       int x = 0;

                       switch (Contact.Status.ToString())
                       {
                           case "MISTATUS_ONLINE": x = 1; break;
                           case "MISTATUS_AWAY": x = 2; break;
                           case "MISTATUS_BUSY": x = 3; break;
                           case "MISTATUS_BE_RIGHT_BACK": x = 2; break;
                           case "MISTATUS_OUT_TO_LUNCH": x = 2; break;
                           case "MISTATUS_ON_THE_PHONE": x = 2; break;
                           case "MISTATUS_IDLE": x = 4; break;
                           default: x = 0; break;
                       }

                       TreeNode node = new TreeNode();
                       node.Name = Contact.SigninName;

                       if (Contact.FriendlyName.Length > 35)
                       {
                           node.Text = Contact.FriendlyName.Substring(0, 35) + "...";
                       }
                       else
                       {
                           node.Text = Contact.FriendlyName;
                       }

                       node.ImageIndex = x;
                       node.SelectedImageIndex = x;

                       if (x != 0)
                       {
                           treeView1.Nodes["NodeOnline"].Nodes.Add(node);
                       }
                       else
                       {
                           treeView1.Nodes["NodeOffline"].Nodes.Add(node);
                       }

                       treeView1.ExpandAll();

                       SetRootText();
                   }
               }
               else
               {
                   this.Text = "Niet aangemeld";
               }

               
           }
           catch (Exception error)
           {
               MessageBox.Show(error.Message, "Foutmelding", MessageBoxButtons.OK, MessageBoxIcon.Error);
           }
       }
       private void SetRootText()
       {
           int intOnline = treeView1.Nodes[0].Nodes.Count;
           treeView1.Nodes[0].Text = "Online {" + intOnline.ToString() + "}";

           int intOffline = treeView1.Nodes[1].Nodes.Count;
           treeView1.Nodes[1].Text = "Offline {" + intOffline.ToString() + "}";
       }
       private string TranslateStatus(MessengerAPI.MISTATUS _Status)
       {
           string Status = null;

           switch (_Status.ToString())
           {
               case "MISTATUS_AWAY": Status = "Afwezig"; break;
               case "MISTATUS_ONLINE": Status = "Online"; break;
               case "MISTATUS_OFFLINE": Status = "Offline"; break;
               case "MISTATUS_BUSY": Status = "Bezet"; break;
               case "MISTATUS_BE_RIGHT_BACK": Status = "Zo terug"; break;
               case "MISTATUS_ON_THE_PHONE": Status = "Aan de telefoon"; break;
               case "MISTATUS_OUT_TO_LUNCH": Status = "Lunchpauze"; break;
               case "MISTATUS_IDLE": Status = "Niet actief"; break;
               default: Status = _Status.ToString(); break;
           }

           return Status;
       }

       void MSN_OnMyStatusChange(int hr, MessengerAPI.MISTATUS mMyStatus)
       {
           textBox1.Text = DateTime.Now.ToShortTimeString() + " - Je status is veranderd. [" + TranslateStatus(mMyStatus) + "]";
       }

       void MSN_OnContactStatusChange(object pMContact, MessengerAPI.MISTATUS mStatus)
       {
           MessengerAPI.IMessengerContact Contact = (MessengerAPI.IMessengerContact) pMContact;

           if (mStatus == MessengerAPI.MISTATUS.MISTATUS_OFFLINE)
           {
               TreeNode node = new TreeNode();
               node.Text = Contact.FriendlyName;
               node.Name = Contact.SigninName;
               node.ImageIndex = GetImageIndex(Contact.Status);
               node.SelectedImageIndex = GetImageIndex(Contact.Status);

               treeView1.Nodes[0].Nodes.Add(node);
               treeView1.Nodes[1].Nodes.RemoveAt(treeView1.Nodes[1].Nodes[Contact.SigninName].Index);
           }
           else
           {
               if (Contact.Status == MessengerAPI.MISTATUS.MISTATUS_OFFLINE)
               {
                   TreeNode node = new TreeNode();
                   node.Text = Contact.FriendlyName;
                   node.Name = Contact.SigninName;
                   node.ImageIndex = GetImageIndex(Contact.Status);
                   node.SelectedImageIndex = GetImageIndex(Contact.Status);

                   treeView1.Nodes[1].Nodes.Add(node); 

                   treeView1.Nodes[0].Nodes.RemoveAt(treeView1.Nodes[0].Nodes[Contact.SigninName].Index);
               }
               else
               {
                   TreeNodeCollection nodes = treeView1.Nodes;

                   foreach (TreeNode node in nodes)
                   {
                       if (node.Name == Contact.SigninName)
                       {
                           node.ImageIndex = GetImageIndex(Contact.Status);
                           node.SelectedImageIndex = GetImageIndex(Contact.Status);
                       }
                   }
               }
           }

         SetRootText();

           string Name = null;

           if (Contact.FriendlyName.Length > 35)
           {
               Name = Contact.FriendlyName.Substring(0, 35) + "...";
           }
           else
           {
               Name = Contact.FriendlyName;
           }

           textBox1.Text = DateTime.Now.ToShortTimeString() + " - " + Name + " heeft zijn of haar status veranderd. [" + TranslateStatus(Contact.Status) + "]";
       }

       private void pictureBox2_Click(object sender, EventArgs e)
       {
           if (this.TopMost)
           {
               this.TopMost = false;
               this.ShowInTaskbar = true;
           }
           else
           {
               this.TopMost = true;
               this.ShowInTaskbar = false;
           }

           treeView1.ExpandAll();
       }

       private int GetImageIndex(MessengerAPI.MISTATUS mMyStatus)
       {
           int i =0;

           switch (mMyStatus.ToString())
           {
               case "MISTATUS_AWAY": i = 2; break;
               case "MISTATUS_ONLINE": i = 1; break;
               case "MISTATUS_OFFLINE": i = 0; break;
               case "MISTATUS_BUSY": i = 3; break;
               case "MISTATUS_BE_RIGHT_BACK": i = 2; break;
               case "MISTATUS_ON_THE_PHONE": i = 2; break;
               case "MISTATUS_OUT_TO_LUNCH": i = 2; break;
               case "MISTATUS_IDLE": i = 4; break;
               default: i = 0; break;
           }

           return i;
       }

       private void pictureBox4_Click(object sender, EventArgs e)
       {
           Application.Exit();
       }

       private void pictureBox3_Click(object sender, EventArgs e)
       {
           this.ShowInTaskbar = true;
           this.WindowState = FormWindowState.Minimized;
           this.TopMost = false;

           treeView1.ExpandAll();
       }

       private void btnOnline_Click(object sender, EventArgs e)
       {
           MSN.MyStatus = MessengerAPI.MISTATUS.MISTATUS_ONLINE;
       }

       // geeft een fatale error
       private void btnOffline_Click(object sender, EventArgs e)
       {
           MSN.MyStatus = MessengerAPI.MISTATUS.MISTATUS_OFFLINE;
       }

       private void btnAfwezig_Click(object sender, EventArgs e)
       {
           MSN.MyStatus = MessengerAPI.MISTATUS.MISTATUS_AWAY;
       }

       private void btnBezet_Click(object sender, EventArgs e)
       {
           MSN.MyStatus = MessengerAPI.MISTATUS.MISTATUS_BUSY;
       }

       private void btnZoTerug_Click(object sender, EventArgs e)
       {
           MSN.MyStatus = MessengerAPI.MISTATUS.MISTATUS_BE_RIGHT_BACK;
       }

       private void btnLunchpauze_Click(object sender, EventArgs e)
       {
           MSN.MyStatus = MessengerAPI.MISTATUS.MISTATUS_OUT_TO_LUNCH;
       }

       private void btnAanDeTelefoon_Click(object sender, EventArgs e)
       {
           MSN.MyStatus = MessengerAPI.MISTATUS.MISTATUS_ON_THE_PHONE;
       }

       private void listView1_DoubleClick(object sender, EventArgs e)
       {
           MessengerAPI.IMessengerContact ImContact = (MessengerAPI.IMessengerContact)MSN.GetContact("bien_blue45[at]hotmail[dot]com", MSN.MyServiceId);
           MSN.InstantMessage(ImContact);
       }

       private void treeView1_DoubleClick(object sender, EventArgs e)
       {
           try
           {
               TreeNode node = (TreeNode)treeView1.SelectedNode;
               
               string Email = node.Name;

               if (Email != "NodeOnline" || Email != "Offline")
               {
                   MessengerAPI.IMessengerContact ImContact = (MessengerAPI.IMessengerContact)MSN.GetContact(node.Name, MSN.MyServiceId);
                   MSN.InstantMessage(ImContact);
               }
           }
           catch (Exception error)
           {
               MessageBox.Show(error.Message, "Foutmelding", MessageBoxButtons.OK, MessageBoxIcon.Error);
           }
       }

       private void pictureBox5_Click(object sender, EventArgs e)
       {
           MSN.OpenInbox();
       }
   }
}

private void btnSendMsg_Click(object sender, EventArgs e)
        {
            MessengerAPI.Messenger MSN = new MessengerAPI.Messenger();

            object MsnWindow = MSN.InstantMessage(listContacts.Text);
            SendKeys.Send(txtMessage.Text + "{Enter}");
        }

Well what do you have to say now, Messanger API are not used by all users and there is not a lot of experts on this issue, a little google and hard work will get you there, u can't expect us to do your homework right?

C# DOES NOT HAVE TO BE managed code.

C# DOES NOT HAVE TO BE managed code.

Yea and ddanbe is right C# does not have to be managed code, there is a lot of forums about this issue too on google.

Sorry but is that API for Yahoo! Messenger? or MSN?

Sorry but is that API for Yahoo! Messenger? or MSN?

Sorry it is for msn but googled again and there it is:
http://developer.yahoo.com/dotnet/
Google baby google

Baby, I just have to google what i seek: Yahoo! Messenger API and NOT web service API and a million ohter things I can google. So please read better: that does not include YM API. However thanks for your interest and google-ing :). I appreciate it! really

Please read that page. Does not include Y! Messenger. Those are some WEB services API's. Thanks for your replies! :) sorry i posted twice

Baby, I just have to google what i seek: Yahoo! Messenger API and NOT web service API and a million ohter things I can google. So please read better: that does not include YM API. However thanks for your interest and google-ing :). I appreciate it! really

Yea so why in the head of the page its written:

This site is your source for information about using the .NET Framework with Yahoo! Web Services and APIs. Here you'll find:

Now you dont know how to read also?

Let's not turn this into a flame war :/
OBVIOUSLY google has the resources you're looking for...

Let's not turn this into a flame war :/
OBVIOUSLY google has the resources you're looking for...

You are right. OK. I will search more and I will post if i find something :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.