Receive a message
It is the way to determine whether the new message is to receive whether the content is "Text" type, the code is as follows
Private void ontextRecieved (Messenger.imsgrimsession S,
Messenger.imsgruser u, string header, String text,
Ref Bool Default
{
IF (Header.indexof ("Content-Type: Text / Plain)! = -1 &&
u.FriendlyName! = "Hotmail")
{
MessageWindow.AppendText (u.friendlyname ":" Text "/ r / n");
Currentuser = u;
DEFAULT = FALSE;
}
}
send messages
Enter the message you want to send to the Edit box, then click the "Send" button, the content in the Edit box will be sent by the following code:
Private stat String header =
"MIME-VERSION: 1.0 / R / NContent-Type: text / place;"
"charSet = UTF-8 / R / NX-MMS-IM-FORMAT:"
"Fn = MS% 20Shell% 20dlg; EF =; CO = 0; CS = 0; Pf = 0 / r / N / R / N";
Private void send_click (Object Sender, System.Eventargs E)
{
CurrentUser.sendtext (header, this.sendtext.text,
Messenger.mmsgtype.mmsgtype_all_results;
MessageWindow.AppendText ("You Say:" SendText.Text "/ R / N");
}
Update the status of the contact
I used different icons in ListView to indicate the status of the contact. When the constructor is called, the status of the contact is set for the first time. When the contact status changes, the onusersTatusChanged () event is called, updating the status of the contact.
Private void OnuserstateChanged (Messenger.imsgruser User,
Messenger.mstate State, Ref Bool Default
{
For (int i = 0; i { IF (user == users.Item (i)) { ListviewItem item = userlist.items [i]; Item.imageIndex = getStateImage (user.state); } } } summary I hope that everyone will be interested in this article. Through this article, we also understand a small part of the MSN. MSN has many other features waiting for us to explore. OK, now we know that it is very easy to create a vs.NET external program, you can create more creative add-in.