What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Release] mPSM (Version 1.32)

[Release] mPSM (Version 1.32)
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [Release] mPSM (Version 1.32)
[OFF TOPIC]

Originally edited in in previous post, but didn't saw you already replied, so:

EDIT & PS: don't get me wrong, I'm not entirly 100% behind what I've said here in my previous post myself... but it is a tricky subject, and my initial reaction was probably because of the way you replied to his script like he did something seriously bad while you didn't included anything new or different in that code compared to the original code shown on MSNFanatic (eg: like checking for string length, polygamy issue, etc), it is not even optimized or whatever, just a copy in itself.

quote:
Originally posted by -dt-
yes but the fact is he didnt do it himself
that's very true too...

[/OFF TOPIC]

quote:
Originally posted by -dt-
i personally dont agree with sending it only to the current process, but heh i dont use polygamy but checking if the string is too long is a good idea though

The reason for the need for polygamy compatibility is because such scripts as this might be configured differently according to who is logged in. If you don't include this, and one uses polygamy the script will even send the string multiple times to all messengers because of the way scripts are run in Plus!, which is useless...

Anyways, I would do it like this when I just copy the original code (so no double unneeded checks):
code:
// Sends to all running messengers
var hMSGRUI = 0;
while (hMSGRUI = Interop.Call('User32', 'FindWindowExW', 0, hMSGRUI, 'MsnMsgrUIManager', 0))
        Interop.Call('User32', 'SendMessageW', hMSGRUI, WM_COPYDATA, 0, copyDataStruct);
And my recommended implementation:
code:
// Sends only to our own messenger
var tIDCurrent = Interop.Call('Kernel32', 'GetCurrentThreadId');
var hMSGRUI = 0;
while (hMSGRUI = Interop.Call('User32', 'FindWindowExW', 0, hMSGRUI, 'MsnMsgrUIManager', 0))
        if (Interop.Call('User32', 'GetWindowThreadProcessId', hMSGRUI, 0) === tIDCurrent)
                Interop.Call('User32', 'SendMessageW', hMSGRUI, WM_COPYDATA, 0, copyDataStruct);
To make sure the string isn't too long, to avoid errors:
code:
song.WriteString(0, ('\\0' + type + '\\0' + Math.abs(enabled) + '\\0' + format + '\\0' + title + '\\0' + artist + '\\0' + album + '\\0' + contentID).substr(0, 253) + '\\0');

This post was edited on 01-01-2007 at 07:39 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
01-01-2007 07:30 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Release] mPSM (Version 1.32) - by Spunky on 12-30-2006 at 09:55 PM
RE: [Release] mPSM (Version 1.32) - by nod32 on 01-01-2007 at 03:48 PM
RE: [Release] mPSM (Version 1.32) - by -dt- on 01-01-2007 at 04:22 PM
RE: [Release] mPSM (Version 1.32) - by CookieRevised on 01-01-2007 at 06:28 PM
RE: [Release] mPSM (Version 1.32) - by EBFL on 01-01-2007 at 06:35 PM
RE: [Release] mPSM (Version 1.32) - by CookieRevised on 01-01-2007 at 06:40 PM
RE: [Release] mPSM (Version 1.32) - by -dt- on 01-01-2007 at 06:41 PM
RE: [Release] mPSM (Version 1.32) - by CookieRevised on 01-01-2007 at 07:30 PM
RE: [Release] mPSM (Version 1.32) - by Spunky on 01-01-2007 at 09:02 PM
RE: [Release] mPSM (Version 1.32) - by DiExE on 08-16-2008 at 03:10 PM


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