What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Took me a few hours...

Took me a few hours...
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
RE: RE: Took me a few hours...
I don't know if this would affect it, but...
quote:
Originally posted by Yustme
JScript code:
function Registry_SetKeyValue(lKeyLocation, sKey, sKeyName, sKeyValue, lpType) {
    var hKey = Interop.Allocate(4);
    var lRetVal = Interop.Call('advapi32.dll', 'RegOpenKeyExW', lKeyLocation, sKey, 0, KEY_WRITE, hKey);
    if (lRetVal === ERROR_SUCCESS) {
        switch (lpType) {
            case REG_EXPAND_SZ :
            case REG_MULTI_SZ :
            case REG_SZ :                sKeyValue = String(sKeyValue);
                var buff_size = sKeyValue.length;
                var lBufferSize = Interop.Allocate(4);
                lBufferSize.WriteDWORD(0, (2 * buff_size + 2));
                lRetVal = Interop.Call('advapi32.dll', 'RegSetValueExW', hKey.ReadDWORD(0), sKeyName, 0, lpType, sKeyValue, lBufferSize.ReadDWORD(0));
                break;
            case REG_DWORD :
                var lKeyValue = Interop.Allocate(4);
                lKeyValue.WriteDWORD(0, (sKeyValue & 0xFFFFFFFF));
                lRetVal = Interop.Call('advapi32.dll', 'RegSetValueExW', hKey.ReadDWORD(0), sKeyName, 0, REG_DWORD, lKeyValue, 4);
                break;
            case REG_BINARY :                sKeyValue = String(sKeyValue);
                var lBufferSize = Interop.Allocate(4);
                lBufferSize.WriteDWORD(0, (2 * sKeyValue.length + 2));
                lRetVal = Interop.Call('advapi32.dll', 'RegSetValueExW', hKey.ReadDWORD(0), sKeyName, 0, REG_BINARY, sKeyValue, lBufferSize.ReadDWORD(0));
                break;
            default : return false;
        }
        Registry_CloseKey(hKey.ReadDWORD(0));
        return lRetVal === ERROR_SUCCESS;
    } else { return false; }
}

(...)
JScript code:
function OnEvent_Initialize(MessengerStart)
{
  var MPLkey = 'SOFTWARE\\Patchou\\Messenger Plus! Live';
var WLMkey;
var WLMexe;
 
 
if(Messenger.Version >= 8.5)
{
    WLMkey = 'SOFTWARE\\Microsoft\\MSNMessenger';
    WLMexe = 'SOFTWARE\\Microsoft\\Windows Live\\Messenger';
}
 
else
{
    WLMkey = 'SOFTWARE\\Microsoft\\MSNMessenger';
    WLMexe = WLMkey;
}
 
var resultWLMkey = Registry_SetKeyValue(HKEY_CURRENT_USER, WLMkey + '\\PerPassportSettings', 'DefaultMemberName', email, 'REG_BINARY'); 
var resultMPLkey = Registry_SetKeyValue(HKEY_CURRENT_USER, MPLkey, 'DefaultUser', email, 'REG_SZ'); 
Debug.Trace("Registry_SetKeyValue resultWLMkey = " + resultWLMkey);
Debug.Trace("Registry_SetKeyValue resultMPLkey = " + resultMPLkey);
}


The Registry_SetKeyValue() function takes the key type as an enumeration (a variable name), whereas you have defined them as strings.  Try it without the single quotes.
02-21-2010 03:57 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Took me a few hours... - by Yustme on 02-12-2010 at 07:07 PM
RE: Took me a few hours... - by matty on 02-18-2010 at 04:48 PM
RE: Took me a few hours... - by billyy on 02-18-2010 at 10:08 PM
RE: Took me a few hours... - by Spunky on 02-18-2010 at 10:53 PM
RE: Took me a few hours... - by matty on 02-19-2010 at 03:53 AM
RE: Took me a few hours... - by CookieRevised on 02-19-2010 at 06:07 AM
RE: Took me a few hours... - by Yustme on 02-19-2010 at 11:14 AM
RE: Took me a few hours... - by matty on 02-19-2010 at 12:02 PM
RE: Took me a few hours... - by billyy on 02-19-2010 at 04:54 PM
RE: Took me a few hours... - by matty on 02-19-2010 at 06:52 PM
RE: Took me a few hours... - by billyy on 02-19-2010 at 10:06 PM
RE: Took me a few hours... - by Yustme on 02-21-2010 at 12:28 PM
RE: RE: Took me a few hours... - by whiz on 02-21-2010 at 03:57 PM
RE: Took me a few hours... - by Yustme on 02-21-2010 at 04:01 PM
RE: Took me a few hours... - by whiz on 02-21-2010 at 04:31 PM
RE: Took me a few hours... - by Matti on 02-21-2010 at 10:38 PM
RE: Took me a few hours... - by matty on 02-22-2010 at 03:52 AM


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