CoePSX Posted March 23, 2007 Share Posted March 23, 2007 (edited) Hello All. I was trying to find out how Winamp changes the MSN Messenger music song message. It sends WM_COPYDATA messages to a hidden MSN window with classname "MsnMsgrUIManager". The data pointed by LPARAM is a COPYDATASTRUCT with the number 0x547 in the dwData field. This is a number MSN uses to identify personal message changes. The string pointed by the lpData field is a unicode string with the following format: "Winamp \ 0Music\ 01\ 0{0}\ 0Text_here\ 0\ 0\ 0\ 0\ 0" (no spaces between backslashes and zeroes). These \ 0s are not nulls. They are actually backslashes and zeroes. Googling around I found some pieces of code. I had some problems making it work, but I found out what the trick was. The cbData field of the COPYDATASTRUCT must be EXACTLY the size of the string pointed by lpData. If it's 1 byte bigger than it won't work. I wrote a little C source code and ported it to AutoIt. Arguments: $iType: 0 for music icon, 1 for game icon and 2 for office icon. $bEnable: True to show the message or False to make it return to the normal state. $szText: The text you want to show, like "My song - My artist" expandcollapse popupFunc ChangeMSNMessage ($iType, $bEnable, $szText) Local Const $szFormat = "Winamp\%s\%d\{0}\%s\\\\\" Local Const $WM_COPYDATA = 0x4A Local $szType Local $szMessage Local $iSize Local $pMem Local $stCopyData Local $hWindow ;; Format the message ;; Switch ($iType) Case 1 $szType = "Games" Case 2 $szType = "Office" Case Else $szType = "Music" EndSwitch $szMessage = StringFormat ($szFormat, $szType, $bEnable, $szText) ;; Create a unicode string ;; $iSize = StringLen ($szMessage) + 1 $pMem = DllStructCreate ("ushort[" & $iSize & "]") For $i = 0 To $iSize DllStructSetData ($pMem, 1, Asc (StringMid ($szMessage, $i, 1)), $i) Next DllStructSetData ($pMem, 1, 0, $iSize) ;; Create the COPYDATASTRUCT ;; $stCopyData = DllStructCreate ("uint;uint;ptr") DllStructSetData ($stCopyData, 1, 0x547) ;dwData = MSN magic number DllStructSetData ($stCopyData, 2, ($iSize * 2)) ;cbData = Size of the message DllStructSetData ($stCopyData, 3, DllStructGetPtr ($pMem)) ;lpData = Pointer to the message ;; Send the WM_COPYDATA message ;; $hWindow = DllCall ("user32", "hwnd", "FindWindowExA", "int", 0, "int", 0, "str", "MsnMsgrUIManager", "int", 0) While ($hWindow[0]) DllCall ("user32", "int", "SendMessageA", "hwnd", $hWindow[0], "int", $WM_COPYDATA, "int", 0, "ptr", DllStructGetPtr ($stCopyData)) $hWindow = DllCall ("user32", "hwnd", "FindWindowExA", "int", 0, "hwnd", $hWindow[0], "str", "MsnMsgrUIManager", "int", 0) WEnd ;; Cleanup ;; $pMem = 0 $stCopyData = 0 EndFuncoÝ÷ ØZ+¶,z)íz·¬µçbØ^ Ê.Ç¡×çîËb¢x¬ë-jË&jY¡×¯¢'B©àx÷«²ÚǬ±¨["ØÊ8âÛvìªíÂÌÌzËî5rì·!j»p³1h®fcCh§v"Ø78ö0MNËCjÖ°r«¶ÿÏÉ+m~æjßÿ³r4MSNPSM_example.au3 Edited March 23, 2007 by CoePSX [quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"]╔══════════════════════════════╗║░░██░░░░░░░░██░░███░░░████░░░█║║░█░░█░░██░░█░░█░█░░█░█░░░░█░█░║║░█░░░░█░░█░████░███░░░██░░░█░░║║░█░░█░█░░█░█░░░░█░░░░░░░█░█░█░║║░░██░░░██░░░██░░█░░░░███░█░░░█║╚══════════════════════════════╝[/font] Link to comment Share on other sites More sharing options...
Cyber Posted March 23, 2007 Share Posted March 23, 2007 FANTASTIC! thanks! Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key Link to comment Share on other sites More sharing options...
nend Posted March 23, 2007 Share Posted March 23, 2007 YOUR A GOD!!!! Thanks! Link to comment Share on other sites More sharing options...
arcker Posted March 23, 2007 Share Posted March 23, 2007 excellent implementation if the last dllstruct these evolution are just too cool and let us play easier with api and dll nice idea you made well done -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list] Link to comment Share on other sites More sharing options...
moises-l Posted April 21, 2007 Share Posted April 21, 2007 how can you get the music name to show in msn personal message? thanks Link to comment Share on other sites More sharing options...
therks Posted April 22, 2007 Share Posted April 22, 2007 Hmm.. doesn't work with Windows Live Messenger? Ah well, neat idea anyway. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Pascal257 Posted April 22, 2007 Share Posted April 22, 2007 Hmm.. doesn't work with Windows Live Messenger? Ah well, neat idea anyway.Hmmm... It works for me with Windows Live Messenger also...btw: cool UDF! Using it for my Player =) Link to comment Share on other sites More sharing options...
James Posted April 22, 2007 Share Posted April 22, 2007 This rocks. I love it when people ask how its done! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
therks Posted April 22, 2007 Share Posted April 22, 2007 (edited) Hmmm... It works for me with Windows Live Messenger also...Weird. Maybe I'm misunderstanding how it's supposed to work. It's just supposed to change my personal message right? That string of text that appears after my user name in other people's contact lists? Do I check off "Show what I'm listening to" ? I've tried it checked and unchecked and there doesn't seem to be a difference.Nevermind, nevermind, nevermind, nevermind... I'm a moron. Heh. I was copying the script from the code tags in the initial post and trying that, even though right after the code CoePSX says the forum erased the \ 0's and I never put them back in.So yeah, I grabbed the attachment and it works great.Sorry for being an idiot! Edited April 22, 2007 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
gsb Posted April 25, 2007 Share Posted April 25, 2007 (edited) Nice job. I modified it slightly. Put together a file of quotes... you know, dumb little sayings. Then modified the code as follows: Dim $list = StringSplit( String( FileRead( "MSN_quotes.txt" ) ), @LF, 1 ) While (1) ChangeMSNMessage (0, True, $list[ Random(1, $List[0], 1) ]) Sleep (30000) WEnd It now displays random quotes every 30 seconds. ...just to keep it "Windows Live..." you know. Thanks for the nice function. gsb Edited April 25, 2007 by gsb "Did you ever stop to think? ...and forget to restart!" Link to comment Share on other sites More sharing options...
Noobster24 Posted November 27, 2007 Share Posted November 27, 2007 Wow, looks nice, but it doesn't change my personal message in WLM (Windows Live Messenger v8.1). I used the example code you provided, but it doesn't change my personal message in any way. Anyone got it working with WLM? Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc. Link to comment Share on other sites More sharing options...
Pascal257 Posted November 27, 2007 Share Posted November 27, 2007 Wow, looks nice, but it doesn't change my personal message in WLM (Windows Live Messenger v8.1). I used the example code you provided, but it doesn't change my personal message in any way.Anyone got it working with WLM?As I wrote above it's working perfectly with WLM... (its the same as MSN)You might post your code so I can take a look on it. Link to comment Share on other sites More sharing options...
Achilles Posted December 14, 2007 Share Posted December 14, 2007 Good job on this! That's pretty sweet! My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
MaudKip Posted December 14, 2007 Share Posted December 14, 2007 That is a really cool idea. I am going to mess with people lol. Link to comment Share on other sites More sharing options...
Demonshade Posted December 15, 2007 Share Posted December 15, 2007 this is pretty sweet. too bad the Dim $list = StringSplit( String( FileRead( "MSN_quotes.txt" ) ), @LF, 1 ) While (1) ChangeMSNMessage (0, True, $list[ Random(1, $List[0], 1) ]) Sleep (30000) WEnd doesnt display stuff such as @hour and @min. does anyone know how to make it do that? Link to comment Share on other sites More sharing options...
BrettF Posted December 15, 2007 Share Posted December 15, 2007 Look at the attachment. Also, I didn't see it, but then maybe I didn't look hard enough. You had to set it to be show what song is playing? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
xJapx Posted July 9, 2008 Share Posted July 9, 2008 Look at the attachment. Also, I didn't see it, but then maybe I didn't look hard enough. You had to set it to be show what song is playing?Yes, atleast it didn't work for me when I hadn't set it to show what song is playing.Cool script between, fun to play around with! muttley Link to comment Share on other sites More sharing options...
Hest Posted December 15, 2008 Share Posted December 15, 2008 (edited) Nice job. I modified it slightly. Put together a file of quotes... you know, dumb little sayings. Then modified the code as follows: Dim $list = StringSplit( String( FileRead( "MSN_quotes.txt" ) ), @LF, 1 ) While (1) ChangeMSNMessage (0, True, $list[ Random(1, $List[0], 1) ]) Sleep (30000) WEnd It now displays random quotes every 30 seconds. ...just to keep it "Windows Live..." you know. Thanks for the nice function. gsb Can anyone help me make this random file, show hour and minute also. If you put in @HOUR & ":" & @MIN & ":" & @SEC in the .txt file, it shows up as text and not as the time. Any way to change that? I want it to show the time, then some random lines of text and then back to the time again and so on. Edited December 15, 2008 by Hest Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
SaphuA Posted December 16, 2008 Share Posted December 16, 2008 (edited) Yep, pretty cool. Any way to change the personal message aswell, instead of the icon-message as you're doing now? Also, why do you have to give a media players name in the string? And what happens if a media player updates the text? Is it still able to? Edited December 16, 2008 by SaphuA http://www.saphua.com/ Link to comment Share on other sites More sharing options...
BrettF Posted December 16, 2008 Share Posted December 16, 2008 As far as I know you can't. The messenger API does not support it. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now