Windows messebger 5.1api Development

Source: Internet
Author: User
I.. NetAddAPIReferences

1,In Solution Explorer. Right-click Properties and select "add reference"

2,Select"Com"Tab, select"Messenger API Type Library"

3,"Messgerapi"Component

2. Add a user list (two methods are available)

1,Use "file"->"Import contacts from saved files" in the format*. CTTThe format is as follows:

<? XML version = "1.0"?>

<Messenger>

<Service name = "Microsoft RTC instant messaging">

<Contactlist>

<Contact> hxuedong@nmdsy.com </contact>

<Contact> cyaodong@nmdsy.com </contact>

<Contact> sjianli@nmdsy.com </contact>

<Contact> fdg@nmdsy.com </contact>

</Contactlist>

</Service>

</Messenger>

Unfortunately, groups cannot be created here. This is also the recommended method.

2,PassAPIAdd functions, supplemented by keyboard Functions

 (1) To createTxtFile, each row is a mailbox name

Hxuedong@nmdsy.com

Cyaodong@nmdsy.com

(2) Read cyclicallyTxtFile, and call the following functions

Messengerapi. messengerclass G1 =NewMessengerapi. messengerclass ();//. Messengernativeclass ();

G1.addcontact (0,Mailbox name);

System. Windows. Forms. sendkeys. Send ('\ R'. tostring ());//Call the keyboardAPIFunction (equivalent to clicking enter)

System. Windows. Forms. sendkeys. Send ('\ R'. tostring ());//Call the keyboardAPIFunction (equivalent to clicking enter)

This method is not recommended

2. PassAPIFunction sending information

Messengerapi. Messenger M1 =NewMessengerapi. messengerclass ();//InstantiationAPIClass

Messengerapi. imessgerwindow m_window;

ObjectContact = m1.getcontact (Destination mailbox name,"");//Obtain the target user'sContact

M_window = (messengerapi. imessential gerwindow) m1.instantmessage (contact );//Open the dialog box

If(M_window.isclosed)

{

M_window.show ();

}

 

System. Windows. Forms. sendkeys. Send ("UseProgramSent information");//Send message

System. Windows. Forms. sendkeys. Send ('\ R'. tostring ());//Simulate carriage return

System. Windows. Forms. sendkeys. Send ('\ R'. tostring ());//Simulate carriage return

3. Application scenarios

Combined with application systems,ServerTerminal passMessengerSend a message to the client. The disadvantage is thatServerTerminal installationWindows MessengerAnd cannot lock the keyboard (because the keyboard must be simulated ). BecauseMessgerThe backend library of is not public, so this is the only option.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.