What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Skype & Live Messenger » C# - Changing MyMediaMessage

C# - Changing MyMediaMessage
Author: Message:
dezio
New Member
*

Avatar

Posts: 4
Joined: Nov 2009
O.P. C# - Changing MyMediaMessage
With the following C#-Code i can change the MediaMessage in Windows Live Messenger. At least not under Windows 7.

Perhaps you can help me to run this code under Windows 7 successfully.

Thanks

DeZio

code:
[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);

        [DllImport("user32.dll", SetLastError = true)]
        static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);

        [DllImport("user32.dll", SetLastError = true)]
        public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, IntPtr windowTitle);

        private const short WM_COPYDATA = 74;

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

        public COPYDATASTRUCT data;
   
        string actURL = "http://*****";

        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 = "\\0Music\\01\\0{0}\\0" + message + " (" + actURL + ")\\0" + message + "\\0" + message + "\\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)
            {
                //Text = handle.ToString();
                SendMessage(handle, WM_COPYDATA, 0, VarPtr(data));
            }
        }

...
SendMSNMessage(true, "Music", "My Song - My Artist");
...


This post was edited on 11-26-2009 at 01:01 PM by dezio.
11-26-2009 01:01 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On