Shoutbox

Smiley question - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: WLM Plus! Help (/forumdisplay.php?fid=12)
+----- Thread: Smiley question (/showthread.php?tid=71786)

Smiley question by Dann3 on 02-15-2007 at 06:53 PM

Is there any way to make the earphones-smiley, that appers beside the music you currently are listening to?


RE: Smiley question by Matti on 02-15-2007 at 07:09 PM

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);