(Please be sure you have MessengerAPI help or you may not be going to understand what I'm talking about
)
Well, since you've got the Messenger object, you can use its
MyContacts property, which is a MessengerContacts object and is a collection of contacts in the user's contact list. It has a method called
Item(Index) which returns a MessengerContact. This object can be used in Messenger object's
InstantMessage method.
So it may go like...
code:
Dim Counter As Long
Dim Contacts As MessengerAPI.IMessengerContacts
Dim Contact As MessengerAPI.IMessengerContact
Set Contacts = MessengerInstance.MyContacts
For Counter = 1 To Contacts.Count '
Set Contact = Contacts.Item(Counter)
If Contact.Blocked = False Then
'From here use MessengerInstance's InstantMessage method in step 2, and go on
Exit For 'We can exit the loop because a "valid" contact has been found
End If
Next 'It's up to you if you prefer "Next Counter" :p
Note I forgot Item method's "Index" is 0-based or 1-based...Please try on your own. If it's 0-based, the For statmenet should change to
For Counter = 0
To Contacts.Count - 1
You may want to do some check (to see if any window has been created in the loop) after the For loop.