Introduction to Messenger API Type Library

In MSN Messenger 5, the Messenger 1.0 Type Library isn’t available, but the other library, Messenger API Type Library still is. It has some good functionality, but it is a lot more limited than Messenger 1.0 Type Library.

Please note that there is no property to change your friendly name with the Messenger API Type Library, although it can be done using a bit of Win32 API, this is explained at the end of the article.

This article was originally intended for MSN Messenger 5 when it was first released, a lot of the information does not apply to newer versions, and contains a few errors and omissions.

Setting The Reference

In the Visual Basic, menu go to Project > References, tick the item called “Messenger API Type Library” and then click OK.

Declaring & Creating The Object

Everyone should know how to do this, in this case I will be calling it objMessenger throughout.

Option Explicit

Private WithEvents objMessenger As MessengerAPI.Messenger

Private Sub Form_Load()
    Set objMessenger = New MessengerAPI.Messenger
End Sub

Sign In

You can either manually sign in by launching the sign in dialog box (unfortunately, the password doesn’t work, but I added it anyway), or you can do an auto sign in. If there is no saved password, then it just goes to manual sign in. I’ve added 2 error handlers, the first is the one that’s returned if the password is not saved (for auto sign in) and the other is if the user is already signed in.

Public Sub SignIn(ByVal bAuto As Boolean, Optional ByVal sSignInName As String, Optional ByVal sPassword As String)

    Dim MConstants As MSGRConstants

    On Error GoTo ErrorHandle

    If bAuto = True Then
        objMessenger.AutoSignin
    Else

ManualSignIn:

        Call objMessenger.SignIn(0, sSignInName, sPassword)
    End If

    Exit Sub

ErrorHandle:

    MConstants = err.Number

    If MConstants = MSGR_E_FAIL Then
        GoTo ManualSignIn
    ElseIf MConstants = MSGR_E_ALREADY_LOGGED_ON Then
        'The user is already signed in
    End If

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.