Introduction to Messenger API Type Library

Using The MyContacts Property

The property MyContacts needs to be used with the interface called “IMessengerContacts” (well, not really NEEDS, but since the MyContacts properly is declared as Object, it makes it a bit easier).

Dim MsgrContacts As IMessengerContacts

Set MsgrContacts = objMessenger.MyContacts

The procedures Item and Remove are to be used with IMessengerContact interfaces.

Dim MsgrContacts As IMessengerContacts
Dim MsgrContact As IMessengerContact

Set MsgrContacts = objMessenger.MyContacts
Set MsgrContact = MsgrContacts.Item(Index)

And to remove a contact:

Dim MsgrContacts As IMessengerContacts
Dim MsgrContact As IMessengerContact

Set MsgrContact = objMessenger.GetContact("user@mymail.com", objMessenger.MyServiceId)
Call MsgrContacts.Remove(MsgrContact)

This will remove the contact specified by “user@mymail.com”.

The property Count can be used alone:

Dim MsgrContacts As IMessengerContacts

Set MsgrContacts = objMessenger.MyContacts
Debug.Print MsgrContacts.Count

Adding a Contact

Possibly because of unauthorised contact adding, you can only launch the add-contact dialog with the specified email in the textbox. Just leave the hwndParent value as 0.

objMessenger.AddContact 0, "someone@mymail.com"

Putting The Contacts in a Listbox

MyContacts can be used in an enumeration, as follows:

Private Sub LoadContacts()

    Dim MsgrContacts As IMessengerContacts
    Dim MsgrContact As IMessengerContact

    Set MsgrContacts = objMessenger.MyContacts

    For Each MsgrContact In MsgrContacts
        List1.AddItem MsgrContact.SigninName
    Next

End Sub
Pages: 1 2 3 4 5

2 Responses to “Introduction to Messenger API Type Library”


  • Hi,

    Do you know….How to add a new item to menu that shows when i right click on a group or a contact?

    thx,

  • hi,
    I have trayed to open project and ues the refrens “Messenger API Type library” in c# or visual basic but I cant open the dll file
    dos sam on now what to do?
    Thank motti

Comments are currently closed.