Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Case Analysis of C#MSN plug-in Development

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "C#MSN plug-in development case analysis". In daily operation, I believe many people have doubts about C#MSN plug-in development case analysis. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "C#MSN plug-in development case analysis". Next, please follow the editor to study!

C#MSN plug-in development 1. Directly invoke MSN remote service

The most famous Net development environment is the DotMSN development library (open source). DotMSN is an independent open source class library, it does not need to interact with the official MSN Messenger, so you do not need to install MSN Messenger to use DotMSN and MSN Messenger services to communicate. DotMSN is written in C #, so the languages supported by the .NET environment can use .DotMSN class libraries are easy to use and easy to implement. It is flexible, rugged and lightweight for integration into any application system. The application system using DotMSN can realize various functions from creating message robot to customizing client.

If your application needs to communicate with Messenger services, DotMSN is a good tool.

C#MSN plug-in development 2. Component development that calls MSN

The main function comes from referencing MessengerClient.dll.

Develop MSN plug-ins

MSN8.0 opens some interfaces so that we can easily develop plug-ins within its limited scope.

Development environment: VS 2005 .NET 2.0 MSN 8.0

There is a MessengerClient.dll file in the MSN installation directory, which you need to reference to create a plug-in.

Create a new DWORD under the registry SoftWare\ MicroSoft\ MSNMessager: AddInFeatureEnabled value of 1 to enable plug-in functionality

Create a new project and refer to MessengerClient.dll. You can see that some of the internal structures have a general interface for IMessagerAddIN. If we write a plug-in, we extend this interface and rewrite the function void Initialize (Microsoft.Messenger.MessengerClient messenger).

There are not many events and methods inside. Events, that is, receiving messages, sending messages, state change events, methods, that is, sending text and splash screens, think about it over and over again. MS gives us this framework interface that allows us to write robot Robot chat, what else can we do-_-#!!

DLL operation restrictions are also very strict, can not access local files, can not use MemoryStream to allocate memory. If you want to draw a picture, you can only use GDI+ to draw.

I originally wanted to write a plug-in for automatically changing avatars, but I found that the interface did not provide this thing. However, I still put out the simplest example of Sample and extend my plug-in according to this architecture.

Demonstration of C#MSN plug-in development example:

Using System; using System.Drawing; using System.Collections.Generic; using System.Text; using Microsoft.Messenger; namespace Red_angelX.MSNPlusIn. {/ * * / MSN avatar automatic replacement plug-in / @ Author: Red_angelX / public class AutoChangeFace: IMessengerAddIn. {MessengerClient msn; public void Initialize (MessengerClient messager). {msn = messager; msn.AddInProperties.Creator = "Red_angelX" Msn.AddInProperties.Description = "CopyRight (C) 2006-2009 Red_angelX"; msn.AddInProperties.FriendlyName = "avatar automatic replacement plug-in"; msn.AddInProperties.Url = new Uri ("http://blog.csdn.net/Red_angelX"); msn.AddInProperties.Status = UserStatus.Online; http://www.it55.com/ msn.AddInProperties.UserTile = RandImage ()) } private Image RandImage ()... {/ / Font ft = new System.Drawing.Font; Bitmap bm = new Bitmap (48,48); Graphics g = Graphics.FromImage (bm); g.Clear (Color.Black); g.DrawString ("Red", new Font ("16, FontStyle.Italic), Brushes.Red, 0,10) Return bm;}

Loading this DLL,MSN in the MSN menu tools-> options-> add-on also requires the file name of the plug-in, that is, NAMESPACE+CLASS+DLL, that is, my DLL must be: Red_angelX.MSNPlusIn.AutoChangeFace.dll in order to try it normally. If these interfaces can achieve any interesting functions instead of chatbots, it will be exciting-_-#

At this point, the study on "C#MSN plug-in development example analysis" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report