What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » JIT - Debug popups

JIT - Debug popups
Author: Message:
SiliconShadow
New Member
*


Posts: 6
Joined: Apr 2010
O.P. RE: JIT - Debug popups
Sorry I didn't check back after a couple of days and just looked again today, so I am again sorry for resurrecting this issues.

To add some things:
I do now have any extensions installed
I have not made anything myself for this
This is just with Messenger Plus installed ontop of my MSN nothing else
I cannot edit that line or I would of done that already

Example of receiving the error: Start msn with Messenger Plus installed, Exit the program, Receive Runtime error:

---------------------------
Microsoft Development Environment
---------------------------
An exception of type 'Microsoft JScript runtime error: 'Wnd' is null or not an object' was not handled.
---------------------------
OK   
---------------------------

This error doesn't happen with Messenger Plus installed, however it is just annoying but I am hoping there is a proper fix.

The code from the file:
Notes: var WnD is initialised, the error is on line 40
code:
var Wnd;

function OnGetScriptMenu(Location)
{
    var ScriptMenu = "<ScriptMenu>";
    ScriptMenu += "<MenuEntry Id=\"MnuStart\">Edit Name</MenuEntry>";
    ScriptMenu += "</ScriptMenu>";
    return ScriptMenu;
}

function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd)
{
    if(MenuItemId == "MnuStart")
    {
        Wnd = MsgPlus.CreateWnd("NameEditor.xml", "WndMain");
        Wnd.SetControlText("NameEdit", Messenger.MyName);
        Wnd.SetControlText("NameEditPreview", Messenger.MyName);
        Wnd.SendControlMessage('NameEdit', 0xC5, 129, 0);
        Wnd.Combo_AddItem("NamePm", "Name");
        Wnd.Combo_AddItem("NamePm", "Personal Message");
        Wnd.Combo_SetCurSel("NamePm", 0);
        //Wnd.ImageElmt_SetImageFile("emoticon", "WLM_1");
        var len = Wnd.GetControlText("NameEdit").length;
        var EM_SETSEL = 0xB1;
        Interop.Call("user32","SetFocus", Wnd.GetControlHandle("NameEdit"));
        Interop.Call("user32","SendMessageW", Wnd.GetControlHandle("NameEdit"), EM_SETSEL, len, len);
    }
}

function OnWndMainEvent_ComboSelChanged()
{
    if(Wnd.Combo_GetCurSel("NamePm") == 0)
        Wnd.SetControlText("NameEdit", Messenger.MyName);
    else
        Wnd.SetControlText("NameEdit", Messenger.MyPersonalMessage);
}

function OnEvent_Uninitialize(MessengerExit)
{
/*******************
* The error is here
*******************/
    Wnd.Close();
}

function OnWndMainEvent_CtrlClicked(Wnd, ControlId)
{
    // Two Win32 Messages that we will need to send later
    var EM_GETSEL = 0xB0;
    var EM_SETSEL = 0xB1;
    // Allocate some memory for the cursor index
    var Start = Interop.Allocate(4);
    // Number of characters to move the cursor on by later
    var numCharsAdded = 1;
    // Get where the cursor is in the input box
    Interop.Call("user32", "SendMessageW", Wnd.GetControlHandle("NameEdit"), EM_GETSEL, Start, 0);
    // Split the string into two parts on either side of the cursor so we can insert characters in the middle
    var text = Wnd.GetControlText("NameEdit");
    var firstHalf = text.substring(0, Start.ReadDWORD(0));
    var secondHalf = text.substring(Start.ReadDWORD(0), text.length);   
   
    // Insert format codes when the format buttons are pressed
    if(ControlId == "BtnBold")
    {
        Wnd.SetControlText("NameEdit", firstHalf + "·#" + secondHalf);
        numCharsAdded = 2;
    }
    if(ControlId == "BtnUnderline")
    {
        Wnd.SetControlText("NameEdit", firstHalf + "·@" + secondHalf);
        numCharsAdded = 2;
    }
    if(ControlId == "BtnItalic")
    {
        Wnd.SetControlText("NameEdit", firstHalf + "·&" + secondHalf);
        numCharsAdded = 2;
    }
    if(ControlId == "BtnStrikethrough")
    {
        Wnd.SetControlText("NameEdit", firstHalf + "·'" + secondHalf);
        numCharsAdded = 2;
    }
    if(ControlId == "BtnColour")
    {
        var CHOOSECOLOR = Interop.Allocate(36);
        CHOOSECOLOR.WriteDWORD(0, 36); //DWORD lStructSize
        CHOOSECOLOR.WriteDWORD(4, 0); //HWND hwndOwner
        CHOOSECOLOR.WriteDWORD(8, 0); //HWND hInstance
        CHOOSECOLOR.WriteDWORD(12, 0x000000FF); //COLORREF rgbResult (COLORREF = 0x00bbggrr)
        var CustColors = Interop.Allocate(64); //Create an array of 16 COLORREFs for CustColors
        CHOOSECOLOR.WriteDWORD(16, CustColors.DataPtr); //COLORREF *lpCustColors (pointer to our array)
        CHOOSECOLOR.WriteDWORD(20, 3); //DWORD Flags (3 = 2 (CC_FULLOPEN) + 1 (CC_RGBINIT) )
        CHOOSECOLOR.WriteDWORD(24, 0); //LPARAM lCustData
        CHOOSECOLOR.WriteDWORD(28, 0); //LPCCHOOKPROC lpfnHook
        CHOOSECOLOR.WriteDWORD(32, 0); //LPCTSTR lpTemplateName

        //Open the dialog box
        var result = Interop.Call('comdlg32.dll', 'ChooseColorA', CHOOSECOLOR);
        //If the user pressed ok convert it to hex
        if(result == 1)
        {
              //Get decimal values
              var r = CHOOSECOLOR.ReadDWORD(12) & 0xFF;
              var g = (CHOOSECOLOR.ReadDWORD(12) / 0x100) & 0xFF;
              var b = (CHOOSECOLOR.ReadDWORD(12) / 0x10000) & 0xFF;
              //Get hex values
              var hexchars="0123456789ABCDEF";
              var r = hexchars.charAt((r >> 4) & 0xf) + hexchars.charAt(r & 0xF);
              var g = hexchars.charAt((g >> 4) & 0xf) + hexchars.charAt(g & 0xF);
              var b = hexchars.charAt((b >> 4) & 0xf) + hexchars.charAt(b & 0xF);
              Wnd.SetControlText("NameEdit", firstHalf + "·$#" + r + g + b + secondHalf);
              numCharsAdded = 9;
        } else {
            Wnd.SetControlText("NameEdit", firstHalf + "·$" + secondHalf);
            numCharsAdded = 2;
        }
    }
    if(ControlId == "BtnBlack")
    {
        Wnd.SetControlText("NameEdit", firstHalf + "·$1" + secondHalf);
        numCharsAdded = 3;
    }
   
    // Insert special characters when their buttons are pressed
    if(ControlId == "BtnA")
        Wnd.SetControlText("NameEdit", firstHalf + "&#945;" + secondHalf);
    if(ControlId == "BtnE")
        Wnd.SetControlText("NameEdit", firstHalf + "&#949;" + secondHalf);
    if(ControlId == "BtnH")
        Wnd.SetControlText("NameEdit", firstHalf + "&#1085;" + secondHalf);
    if(ControlId == "BtnI")
        Wnd.SetControlText("NameEdit", firstHalf + "&#953;" + secondHalf);
    if(ControlId == "BtnN")
        Wnd.SetControlText("NameEdit", firstHalf + "&#331;" + secondHalf);
    if(ControlId == "BtnNN")
        Wnd.SetControlText("NameEdit", firstHalf + "&#1080;" + secondHalf);
    if(ControlId == "BtnNNN")
        Wnd.SetControlText("NameEdit", firstHalf + "&#1048;" + secondHalf);
    if(ControlId == "BtnO")
        Wnd.SetControlText("NameEdit", firstHalf + "&#963;" + secondHalf);
    if(ControlId == "BtnP")
        Wnd.SetControlText("NameEdit", firstHalf + "&#961;" + secondHalf);
    if(ControlId == "BtnR")
        Wnd.SetControlText("NameEdit", firstHalf + "&#1103;" + secondHalf);
    if(ControlId == "BtnT")
        Wnd.SetControlText("NameEdit", firstHalf + "&#1090;" + secondHalf);
    if(ControlId == "BtnU")
        Wnd.SetControlText("NameEdit", firstHalf + "&#965;" + secondHalf);
    if(ControlId == "BtnW")
        Wnd.SetControlText("NameEdit", firstHalf + "&#969;" + secondHalf);
    if(ControlId == "BtnY")
        Wnd.SetControlText("NameEdit", firstHalf + "&#1095;" + secondHalf);
    if(ControlId == "BtnYY")
        Wnd.SetControlText("NameEdit", firstHalf + "&#1063;" + secondHalf);
    if(ControlId == "BtnTm")
        Wnd.SetControlText("NameEdit", firstHalf + "™" + secondHalf);
    if(ControlId == "BtnCross")
        Wnd.SetControlText("NameEdit", firstHalf + "†" + secondHalf);
    if(ControlId == "BtnRArrow")
        Wnd.SetControlText("NameEdit", firstHalf + "»" + secondHalf);
    if(ControlId == "BtnLArrow")
        Wnd.SetControlText("NameEdit", firstHalf + "«" + secondHalf);
    if(ControlId == "BtnB")
        Wnd.SetControlText("NameEdit", firstHalf + "&#1074;" + secondHalf);
    if(ControlId == "BtnK")
        Wnd.SetControlText("NameEdit", firstHalf + "&#1082;" + secondHalf);
    if(ControlId == "BtnM")
        Wnd.SetControlText("NameEdit", firstHalf + "&#1084;" + secondHalf);
       
    // Set focus back to the edit box and then move the cursor back to where it was
    Interop.Call("user32","SetFocus", Wnd.GetControlHandle("NameEdit"));
    Interop.Call("user32","SendMessageW", Wnd.GetControlHandle("NameEdit"), EM_SETSEL, Start.ReadDWORD(0) + numCharsAdded, Start.ReadDWORD(0) + numCharsAdded);
   
    // The save and the close button
    if(ControlId == "BtnClose")
        Wnd.Visible = false;
    if(ControlId == "BtnSet")
    {
        if(Wnd.Combo_GetCurSel("NamePm") == 0)
            Messenger.MyName = Wnd.GetControlText("NameEdit");
        else
            Messenger.MyPersonalMessage = Wnd.GetControlText("NameEdit");
    }
}

function OnWndMainEvent_EditTextChanged(Wnd, ControlId)
{
    if(ControlId == "NameEdit")
        Wnd.SetControlText("NameEditPreview", Wnd.GetControlText("NameEdit"));
}

ps. I have turned on e-mail notification so I will be able to reply more promptly in the future.
06-06-2010 12:04 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
JIT - Debug popups - by SiliconShadow on 04-05-2010 at 07:59 PM
RE: JIT - Debug popups - by Spunky on 04-05-2010 at 10:10 PM
RE: JIT - Debug popups - by SmokingCookie on 04-07-2010 at 02:53 PM
RE: JIT - Debug popups - by SiliconShadow on 06-06-2010 at 12:04 PM
RE: JIT - Debug popups - by SmokingCookie on 06-06-2010 at 04:03 PM
RE: JIT - Debug popups - by SiliconShadow on 06-06-2010 at 04:50 PM
RE: RE: JIT - Debug popups - by CookieRevised on 06-10-2010 at 10:36 AM
RE: JIT - Debug popups - by Mnjul on 06-06-2010 at 04:54 PM
RE: RE: JIT - Debug popups - by SiliconShadow on 06-06-2010 at 05:13 PM
RE: JIT - Debug popups - by SmokingCookie on 06-06-2010 at 05:18 PM
RE: JIT - Debug popups - by SiliconShadow on 06-06-2010 at 05:23 PM
RE: JIT - Debug popups - by SiliconShadow on 06-11-2010 at 05:35 PM
RE: JIT - Debug popups - by CookieRevised on 06-11-2010 at 06:22 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