MESSAGES PERSOS MSN

cs_Bidou Messages postés 5487 Date d'inscription dimanche 4 août 2002 Statut Membre Dernière intervention 20 juin 2013 - 14 mai 2009 à 08:31
XelectroX Messages postés 209 Date d'inscription samedi 11 novembre 2000 Statut Membre Dernière intervention 6 novembre 2009 - 18 mai 2009 à 16:44
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/50012-messages-persos-msn

XelectroX Messages postés 209 Date d'inscription samedi 11 novembre 2000 Statut Membre Dernière intervention 6 novembre 2009
18 mai 2009 à 16:44
Ok merci beaucoup pour ton code :D
Première différence, je ne sais pas si c'est ca : udtData.dwData &H547S, et idem pour le WM_COPYDATA &H4AS (et j'avais en VB &H547 et &H4A) mais je n'ai pas mon code ici pour tester et comparer directement.
Je n'avais jamais vu ce S ^^
Yaurthek Messages postés 12 Date d'inscription samedi 1 juillet 2006 Statut Membre Dernière intervention 2 juin 2009
18 mai 2009 à 16:13
salut,
j'utilise cette méthode en Vb.Net dans une source ( http://yaurthek.free.fr/?page=dev&id=4 )

voila le code copié collé si ça peut t'aider :

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal Hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Integer
Public Function VarPtr(ByVal o As Object) As Integer
Dim GC As System.Runtime.InteropServices.GCHandle = System.Runtime.InteropServices.GCHandle.Alloc(o, System.Runtime.InteropServices.GCHandleType.Pinned)
Dim ret As Integer = GC.AddrOfPinnedObject.ToInt32

GC.Free()
Return ret
End Function
Private Structure COPYDATASTRUCT
Dim dwData As Integer
Dim cbData As Integer
Dim lpData As Integer
End Structure
Private Const WM_COPYDATA As Short = &H4AS

Public Sub SetMsgPerso(ByRef r_type As String, ByRef r_newMsg As String, Optional ByRef r_bShow As Boolean = True)

Dim udtData As COPYDATASTRUCT
Dim sBuffer As String
Dim hMSGRUI As Integer

'Total length can not be longer then 256 characters!
'Any longer will simply be ignored by Messenger.
'sBuffer = "\0Music\0" & System.Math.Abs(CInt(r_bShow)) & "\0" & r_sFormat & "\0" & r_sArtist & "\0" & r_sTitle & "\0" & r_sAlbum & "\0" & r_sWMContentID & "\0" & vbNullChar
sBuffer = "\0" & r_type & "\0" & System.Math.Abs(CInt(r_bShow)) & "\0" & r_newMsg & "\0" & "\0" & vbNullChar

udtData.dwData = &H547S
udtData.lpData = VarPtr(sBuffer)
udtData.cbData = Len(sBuffer) * 2

Do
hMSGRUI = FindWindowEx(0, hMSGRUI, "MsnMsgrUIManager", vbNullString)

If (hMSGRUI > 0) Then
Call SendMessage(hMSGRUI, WM_COPYDATA, 0, VarPtr(udtData))
End If

Loop Until (hMSGRUI = 0)

End Sub
XelectroX Messages postés 209 Date d'inscription samedi 11 novembre 2000 Statut Membre Dernière intervention 6 novembre 2009
14 mai 2009 à 19:20
Non, c'est toujours fonctionnel avec les dernières versions ;)
cs_Bidou Messages postés 5487 Date d'inscription dimanche 4 août 2002 Statut Membre Dernière intervention 20 juin 2013 61
14 mai 2009 à 08:31
Euh, c'est pour MSN 7 seulement? On est à la version 14 (2009) donc à moins que cette source fonctionne aussi avec les dernières versions (qui maintenant s'appellent Live Messenger), je ne vois pas trop l'intérêt de la source...
Rejoignez-nous