Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Visual Basic 6 - Messenger Api Help
Forum - Visual Basic 6 - Messenger Api Help

Avatar
alebird (Normal User)
Pro


Messaggi: 67
Iscritto: 05/10/2007

Segnala al moderatore
Postato alle 15:55
Giovedė, 31/07/2008
ciao raga vorrei realizzare un programma che interagisce con messenger ma putroppo nel web ci sono solo pezzi di codice..  mi potete dare un link dv si possono studiare queste famose :asd: messenger api? grz in anticipo!

PM Quote
Avatar
GrG (Member)
Guru^2


Messaggi: 3430
Iscritto: 21/08/2007

Segnala al moderatore
Postato alle 16:16
Giovedė, 31/07/2008
č in inglese ma si capisce:
a riferimenti mettere messenger API type library
e poi:
Public WithEvents msn As Messengerapi.Messenger


This should go at the very top of your starting form or in a module.

To let MSN Messenger know that you have done this in the event procedure form_load() add the following code.


CODE

Set msn = New Messengerapi.Messenger



If you started from blank the source code of your program should now look like the following:

CODE

Public WithEvents msn As Messengerapi.Messenger

Private Sub Form_Load()
Set msn = New Messengerapi.Messenger
end sub


Once this is done we are ready to begin programming.

Adding the contacts to a Listbox.

Create a listbox called list1.

I am going to create this example based that you have a list box and one command button on the form, when the command button clicks all the contacts email address's are thrown into the listbox.

CODE

private sub command1_click()
dim msncontact as imessengercontact
dim msncontacts as imessengercontacts
set msncontacts = msn.mycontacts
for each msncontact in msncontacts
list1.additem (msncontact.signinname)
next



Changing status to away.

Based on when a command button is clicked.

CODE

private sub command1_click()
msn.mystatus = msn.MyStatus = MISTATUS_AWAY
end sub


This can also be used to change the status to BRB, Busy, On the phone, Online etc..

This can be used to make a status bomber such as Popupz which i recently made.

Changing the nickname.

There is alot of ways which dont seem to work but the simplist way i have found if the sendkeys method, after not finding long complication methods to work that other people made examples, so i created this.

CODE

private sub command1_click()
msn.OptionsPages 0, MOPT_GENERAL_PAGE
Pause 0.5
SendKeys "New nickname here"
Pause 0.5
SendKeys "{ENTER}"
SendKeys "{ENTER}"
Me.Show
end sub

Sub Pause(interval)
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Sub
[B]Adding a contact:[/B]




CODE

private sub command1_click()
msn.AddContact 0, "example@hotmail.com"
SendKeys "{ENTER}"
Pause 1
SendKeys "{ENTER}"
end sub

Sub Pause(interval)
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Sub


Deleting a contact:

CODE

private sub command1_click()
dim msncontact as imessengercontact
dim msncontacts as imessengercontacts
set msncontacts = msn.mycontacts
Set MsgrContact = msn.GetContact("example@hotmail.com", msn.MyServiceId)
Call MsgrContacts.Remove(MsgrContact)
end sub


Signing Out:

CODE

private sub command1_click()
msn.signout ' simple
end sub


Sending a message to a contact:

CODE

private sub command1_click()
Set MsnWindow = msn.InstantMessage("example@hotmail.com") ' opens window
SendKeys "hello how are you?" 'this is the message to be sent
Pause 0.1
SendKeys "{ENTER}"
SendKeys "{ENTER}"
end sub

PM Quote