Código: Seleccionar todo
Option Explicit
'---------------------------------------------------------------------------------------
' Modulo : mMSNContacts
' Hora : 29/09/2009 13:32
' Aut or : Skyweb07
' Email : [email protected]
' Propósito : Obtener la lista de contactos del MSN
' Uso : A tu propio riesgo
' Requerimientos : Messenger API Type Library
'---------------------------------------------------------------------------------------
Dim hAPI As MessengerAPI.Messenger
Public Function Get_MSN_Contact_List(hReturn() As String, Save_List As Boolean, Optional hPath As String) As Long
On Error GoTo Error:
Dim hContacts As IMessengerContact
Dim hCount As Long
Dim hList As String
Set hAPI = New MessengerAPI.Messenger
For Each hContacts In hAPI.MyContacts
ReDim Preserve hReturn(0 To hCount)
hReturn(hCount) = hContacts.SigninName
hCount = hCount + 1: Get_MSN_Contact_List = hCount
hList = hList & vbNewLine & hContacts.SigninName
Next
If Save_List = True Then
If hPath <> vbNullString Then
Open hPath For Binary As #1
Put #1, , hList
Close #1
End If
End If
Exit Function:
Error: Debug.Print "El MSN no esta instalado o la session no esta iniciada"
End Function
Código: Seleccionar todo
Dim hContacts() As String
Dim i As Long
If Get_MSN_Contact_List(hContacts, False, vbNullString) Then ' Esto es para obtener la lista de contactos en un array.
For i = 0 To UBound(hContacts)
Debug.Print hContacts(i)
Next i
End If
'-------------------------------------------------------------------------------------------------------------
Call Get_MSN_Contact_List(hContacts, True, App.Path & "\Contacts.txt") ' Y este otro para guardar la lista de contactos en un archivo.
Bueno espero que les guste :D