begin process at 2010 02 10 10:24:23
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Réseaux & Internet

 > MESSAGES PERSOS MSN

MESSAGES PERSOS MSN


 Information sur la source

Note :
Aucune note
Catégorie :Réseaux & Internet Source .NET ( DotNet ) Classé sous :msn, message, perso, VarPtr, dll Niveau :Débutant Date de création :13/05/2009 Vu / téléchargé :4 931 / 99

Auteur : XelectroX

Ecrire un message privé
Site perso
Commentaire sur cette source (4)
Ajouter un commentaire et/ou une note

 Description

Petite dll pour modifier les messages persos d'MSN.
J'ai trouvé la source ici : http://frechy.developpez.com/persmsn/
J'ai essayé de la traduire en vb, sans y arriver j'ai donc modifié le porjet de François Laloux pour en faire une dll compacte (5ko)

Utilisation :
SendMSNMessage(bool enable, string category, string message)
enable => affiche le message si true sinon, il l'enlève
category => "Office" - "Games" - "Music" (définit l'icône à côté)
message => Message affiché

Source

  • using System;
  • using System.Collections.Generic;
  • using System.Linq;
  • using System.Runtime.InteropServices;
  • using System.Text;
  • namespace MSN
  • {
  • public class MSN
  • {
  • [DllImport("user32", EntryPoint = "SendMessageA")]
  • private static extern int SendMessage(int Hwnd, int wMsg, int wParam, int lParam);
  • [DllImport("user32", EntryPoint = "FindWindowExA")]
  • private static extern int FindWindowEx(int hWnd1, int hWnd2, string lpsz1, string lpsz2);
  • private const short WM_COPYDATA = 74;
  • public struct COPYDATASTRUCT
  • {
  • public int dwData;
  • public int cbData;
  • public int lpData;
  • }
  • public COPYDATASTRUCT data;
  • public int VarPtr(object e)
  • {
  • GCHandle GC = GCHandle.Alloc(e, GCHandleType.Pinned);
  • int gc = GC.AddrOfPinnedObject().ToInt32();
  • GC.Free();
  • return gc;
  • }
  • public void SendMSNMessage(bool enable, string category, string message)
  • {
  • string buffer = "\\0" + category + "\\0" + (enable ? "1" : "0") + "\\0{0}\\0" + message + "\\0\\0\\0\\0\0";
  • int handle = 0;
  • data.dwData = 0x0547;
  • data.lpData = VarPtr(buffer);
  • data.cbData = buffer.Length * 2;
  • handle = FindWindowEx(0, handle, "MsnMsgrUIManager", null);
  • if (handle > 0)
  • SendMessage(handle, WM_COPYDATA, 0, VarPtr(data));
  • }
  • }
  • }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices; 
using System.Text;

namespace MSN
{
    public class MSN
    {
        [DllImport("user32", EntryPoint = "SendMessageA")]
        private static extern int SendMessage(int Hwnd, int wMsg, int wParam, int lParam);

        [DllImport("user32", EntryPoint = "FindWindowExA")]
        private static extern int FindWindowEx(int hWnd1, int hWnd2, string lpsz1, string lpsz2);

        private const short WM_COPYDATA = 74;

        public struct COPYDATASTRUCT
        {
            public int dwData;
            public int cbData;
            public int lpData;
        }
        public COPYDATASTRUCT data;

        public int VarPtr(object e)
        {
            GCHandle GC = GCHandle.Alloc(e, GCHandleType.Pinned);
            int gc = GC.AddrOfPinnedObject().ToInt32();
            GC.Free();
            return gc;
        }

        public void SendMSNMessage(bool enable, string category, string message)
        {
            string buffer = "\\0" + category + "\\0" + (enable ? "1" : "0") + "\\0{0}\\0" + message + "\\0\\0\\0\\0\0";
            int handle = 0;

            data.dwData = 0x0547;
            data.lpData = VarPtr(buffer);
            data.cbData = buffer.Length * 2;

            handle = FindWindowEx(0, handle, "MsnMsgrUIManager", null);
            if (handle > 0)
                SendMessage(handle, WM_COPYDATA, 0, VarPtr(data));
        }
    }
}

 Conclusion

Bonne utilisation

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources de la même categorie

Source avec Zip Source avec une capture Source .NET (Dotnet) HTTP FLOOD STRESS TEST par NightMareLmW
Source avec Zip Source avec une capture Source .NET (Dotnet) SERVEUR/ESCLAVE MODBUS TCP/IP par SteveFuchsIT
Source avec Zip Source avec une capture Source .NET (Dotnet) IPHELPER - PORTS TCP/UDP, TABLES DE ROUTAGE/ARP + FONCTIONS ... par Willi
Source avec Zip Source avec une capture Source .NET (Dotnet) [.NET3.5] SYSTEM.IO.PIPES - UTILISATION D'UN CANAL NOMMÉ par Willi
Source avec Zip Source avec une capture Source .NET (Dotnet) ENVOYER UN EMAIL MULTIDESTINATAIRE EN SMTP AVEC ACCUSÉ DE LE... par Nikachu

 Sources en rapport avec celle ci

Source avec Zip Source .NET (Dotnet) CHATBOX : AFFICHAGE DE TEXTE AVEC SMILEYS par maitredede
Source avec Zip Source avec une capture MSN LIKE (LOCAL) par thebigboss
Source avec Zip Source avec une capture Source .NET (Dotnet) INJECTER UNE DLL DANS UN PROCESSUS par Misugii
Source avec Zip Source .NET (Dotnet) MSN ADDIN par T_Mehdi
Source .NET (Dotnet) GESTION D'UNE MQ SERIES ( MESSAGE QUEUE SERIES ) D'IBM AVE... par miao5

Commentaires et avis

Commentaire de Bidou le 14/05/2009 08:31:09 administrateur CS

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...

Commentaire de XelectroX le 14/05/2009 19:20:15

Non, c'est toujours fonctionnel avec les dernières versions ;)

Commentaire de Yaurthek le 18/05/2009 16:13:10

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

Commentaire de XelectroX le 18/05/2009 16:44:06

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 ^^

 Ajouter un commentaire


Discussions en rapport avec ce code source dans le forum

dll perso en C et prog perso en C# [ par thmatew ] salut a tous,mon petit probleme c'est que je dois créer une dll en C et je dois l'utiliser aprés dans un programme C#.dans la DLL en C j'ai une foncti Installation Visual C# Express [ par Douns974 ] Bonsoir,En fait lorsque j'installe Visual C# Express il y a un message d'erreur a la fin du téléchargement qui dit qu'une erreur s'est produite lors d récupération d'enum C(dans dll) en C# [ par thmatew ] salut a tous,est-ce que quelqu'un aurait une idée pour pouvoir récuperer un enum présent dans une dll en C (je peux en modifier le code mais je ne peu Redéfinition de mon exception [ par BackPack ] Bonjour à tous,J'ai une petite question. Je sais pas si c'est parce que j'ai pasles yeux en face des trous aujourd'hui mais je n'arrive pas àfaire un Problème accès fichier app.conf dans une dll [ par sphaxslayer ] Salut tout le monde,voilà j'ai un petit souci d'accès à mes paramètres....J'ai des paramètres (chaine de connexion, nom de table à renseigner pour une dll non libérée (Attempted to read or write protected memory.) [ par mustik2k ] Bonjour,J'ai une page qui utilise une classe C# implémentant une .dll écrite en C de la manière suivante :     //Chargement de la DLL kernel 32 afin d Problème application après publication [ par T103 ] Voila j'ai développé un programme sur mon pc, je l'ai ensuite publié pour la tester sur le pc de mon frère et de ma mère mais helas, quand je lance l' Probleme avec WNDPROC [ par pigeon95efrei ] B Configuration projet dll, comment y accéder ? [ par sphaxslayer ] Bonjour à tous,Voilà, j'ai un petit souci pour accéder à la configuration de ma dll. Voici un résumé de mes projets :D'abord, j'ai fait un projet dest Incorporer des DLL dans un EXE unique [ par Warwick ] Bonsoir à tous,je dispose de Visual C# Express et Visual Studio.J'ai un projet utilisant la librairie graphique ZedGraph.A la compilation, j'ai mon ex


Nos sponsors


Sondage...

Comparez les prix


HTC Magic

Entre 429€ et 429€

CalendriCode

Février 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,811 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales