What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » WLM Plus! Help » Smiley question

Smiley question
Author: Message:
Dann3
New Member
*


Posts: 14
– / Male / –
Joined: Aug 2006
O.P. Smiley question
Is there any way to make the earphones-smiley, that appers beside the music you currently are listening to?
02-15-2007 06:53 PM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Smiley question
That's not a smiley, but a media icon. It's not something you can simply add in a message, however you can change your media message by using a SendMessage call with the right message.

All credit for the following code goes to -dt-!
code:
//Modifies the current media, thanks to -dt-!
function setNowPlaying(enabled, type, format, title, artist, album, contentID) {
    //Set empty variables
    if(typeof(type) == "undefined")type = "Music";
    if(typeof(format) == "undefined")format = "";
    if(typeof(title) == "undefined")title = "";
    if(typeof(artist) == "undefined")artist = "";
    if(typeof(album) == "undefined")album = "";
    if(typeof(contentID) == "undefined")contentID = "";
    enabled = Math.abs(enabled);
   
    var WM_COPYDATA = 0x4A;
   
    //Reference
    var song = Interop.Allocate(512);
   
    //Create the Media string
    song.WriteString(0, "\\0" + type + "\\0" + enabled + "\\0" + format +"\\0" + title +"\\0" + artist + "\\0" + album + "\\0" + contentID + "\\0");
   
    //Write our copyDataStruct Structure
    var copyDataStruct = Interop.Allocate(12);
    copyDataStruct.WriteDWORD(0, 0x547); //dwData
    copyDataStruct.WriteDWORD(4, song.Size); //cbData
    copyDataStruct.WriteDWORD(8, song.DataPtr);  //lpData
   
    //Send it to all open messengers
    var hMSGRUI = 0;
    do {
        hMSGRUI = Interop.Call("User32", "FindWindowExW", 0, hMSGRUI, "MsnMsgrUIManager", 0);
        if(hMSGRUI > 0) {
            Interop.Call("User32", "SendMessageW", hMSGRUI, WM_COPYDATA, 0, copyDataStruct);
        }
    } while(hMSGRUI != 0);
}
How to use:
You can set a media message by calling setNowPlaying. The function accepts a lot of parameters, however most of them are optional.

The following example:
code:
setNowPlaying(true, "Music", "Yay! We got some {0}!", "nice messages here");
will make your message look like:
quote:
(8) [cololr=blue]Yay! We got some nice messages here![/color]
As you can see, {0} replaces the song title, {1} is the song artist and {2} is the album name. There's also a content ID which is used by Messenger to link you to a page with song information, but all those parameters can be everything you want! :P
If you only want it to display text, the best thing you can do is placing all the things in the format parameter, because otherwise when you click the link, it'll send you to a song page which is totally wrong of course! :P

And, to disable the media message, it's even easier:
code:
setNowPlaying(false);
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
02-15-2007 07:09 PM
Profile E-Mail PM Web 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