|  JIT - Debug popups | 
 
| Author: | 
Message: | 
 
SiliconShadow 
New Member 
 
  
 
Posts: 6 
Joined: Apr 2010 
 | 
O.P.  JIT - Debug popups
MY JIT (Just in time debugger) Kicks in every time I close msn with MsgPlus installed on the Wnd.Close() line, the debugger says Wnd is undefined. 
code: function OnEvent_Uninitialize(MessengerExit) 
{ 
    Wnd.Close(); 
}
  
Does anyone have a possible solution to this?
 
Regards, 
SS  
 |   
 | 
 
| 04-05-2010 07:59 PM | 
 | 
 
  | 
 
Spunky 
Former Super Mod 
     
  
  
 
Posts: 3656 Reputation: 61 
37 /   /   
Joined: Aug 2006 
 | 
| 
 RE: JIT - Debug popups
 Wnd is usually a Plus! window that you have opened. Either the variable Wnd is not created or the variable is being declared in the wrong scope (local instead of global). 
 
To make sure the variable is in the right scope, put "var Wnd;" outside all functions and change the line that opens the window to "Wnd = MsgPlus.CreateWnd('interface.xml', 'myWindow');" 
 
If that gives the same error  then the window is just not being created, possibly due to an error in the XML markup 
<Eljay> "Problems encountered: shit blew up"    
 |   
 | 
 
| 04-05-2010 10:10 PM | 
 | 
 
  | 
 
SmokingCookie 
Senior Member 
    
  
  
 
Posts: 815 Reputation: 15 
31 /   /   
Joined: Jul 2007 
 | 
 RE: JIT - Debug popups
You need to provide the ExitCode parameter as well: 
JScript code: function OnEvent_Uninitialize(MessengerExit) 
{ 
    Wnd.Close(0 /* numeric value */); 
}
   
 |   
 | 
 
| 04-07-2010 02:53 PM | 
 | 
 
  | 
 
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 + "α" + secondHalf); 
    if(ControlId == "BtnE") 
        Wnd.SetControlText("NameEdit", firstHalf + "ε" + secondHalf); 
    if(ControlId == "BtnH") 
        Wnd.SetControlText("NameEdit", firstHalf + "н" + secondHalf); 
    if(ControlId == "BtnI") 
        Wnd.SetControlText("NameEdit", firstHalf + "ι" + secondHalf); 
    if(ControlId == "BtnN") 
        Wnd.SetControlText("NameEdit", firstHalf + "ŋ" + secondHalf); 
    if(ControlId == "BtnNN") 
        Wnd.SetControlText("NameEdit", firstHalf + "и" + secondHalf); 
    if(ControlId == "BtnNNN") 
        Wnd.SetControlText("NameEdit", firstHalf + "И" + secondHalf); 
    if(ControlId == "BtnO") 
        Wnd.SetControlText("NameEdit", firstHalf + "σ" + secondHalf); 
    if(ControlId == "BtnP") 
        Wnd.SetControlText("NameEdit", firstHalf + "ρ" + secondHalf); 
    if(ControlId == "BtnR") 
        Wnd.SetControlText("NameEdit", firstHalf + "я" + secondHalf); 
    if(ControlId == "BtnT") 
        Wnd.SetControlText("NameEdit", firstHalf + "т" + secondHalf); 
    if(ControlId == "BtnU") 
        Wnd.SetControlText("NameEdit", firstHalf + "υ" + secondHalf); 
    if(ControlId == "BtnW") 
        Wnd.SetControlText("NameEdit", firstHalf + "ω" + secondHalf); 
    if(ControlId == "BtnY") 
        Wnd.SetControlText("NameEdit", firstHalf + "ч" + secondHalf); 
    if(ControlId == "BtnYY") 
        Wnd.SetControlText("NameEdit", firstHalf + "Ч" + 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 + "в" + secondHalf); 
    if(ControlId == "BtnK") 
        Wnd.SetControlText("NameEdit", firstHalf + "к" + secondHalf); 
    if(ControlId == "BtnM") 
        Wnd.SetControlText("NameEdit", firstHalf + "м" + 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 | 
 | 
 
  | 
 
SmokingCookie 
Senior Member 
    
  
  
 
Posts: 815 Reputation: 15 
31 /   /   
Joined: Jul 2007 
 | 
| 
 RE: JIT - Debug popups
 I think this error occurs only when you restart or uload the script if you have not clicked the menu item yet. If otherwise, please make sure the XML document is valid and no ControlID is assigned to more than one control. 
 
(Edit: same goes for ElementIDs) 
 This post was edited on 06-06-2010 at 04:04 PM by SmokingCookie.
 |   
 | 
 
| 06-06-2010 04:03 PM | 
 | 
 
  | 
 
SiliconShadow 
New Member 
 
  
 
Posts: 6 
Joined: Apr 2010 
 | 
| 
O.P.  RE: JIT - Debug popups
 As I said it occurs on my machine after a clean install of MSN and Messenger Plus with no scripts, and it happens when closing MSN even if I do not login. 
 
I havn't been able to find a way of stopping this error. 
 
Conditions: 
Vista Ultimate x64 All service updates and patches 
.net - up to date 
Visual studio 2008 express 
MSN 
Messenger Plus 
 
Action: 
Run msn then choose "Exit" 
 
What happens: 
Script error as described in the above posts 
 
 
 |   
 | 
 
| 06-06-2010 04:50 PM | 
 | 
 
  | 
 
Mnjul 
forum super mod 
      
  
  
plz wub me
  
Posts: 5396 Reputation: 58 
– /   /   
Joined: Nov 2002
 
Status: Away
 
 | 
 RE: JIT - Debug popups
I'm pretty sure you have  WLNameEditor installed. Is it present in your Preferences' Script section?  
 |   
 | 
 
| 06-06-2010 04:54 PM | 
 | 
 
  | 
 
SiliconShadow 
New Member 
 
  
 
Posts: 6 
Joined: Apr 2010 
 | 
O.P.  RE: RE: JIT - Debug popups
quote: Originally posted by Mnjul 
I'm pretty sure you have WLNameEditor installed. Is it present in your Preferences' Script section?
  
No it isn't, could it be a cache problem them because I did have it installed, I will try and clear out precache.  
 |   
 | 
 
| 06-06-2010 05:13 PM | 
 | 
 
  | 
 
SmokingCookie 
Senior Member 
    
  
  
 
Posts: 815 Reputation: 15 
31 /   /   
Joined: Jul 2007 
 | 
 RE: JIT - Debug popups
The problem with your script is, that the window must have been created, before you can destroy it. You should be able to overcome this problem by replacing the faulty line with this: 
JScript code:     if(typeof Wnd === "object" && Wnd !== null) Wnd.Close();
  
I'm pretty sure this'll do it...    
 This post was edited on 06-06-2010 at 05:19 PM by SmokingCookie.
 |   
 | 
 
| 06-06-2010 05:18 PM | 
 | 
 
  | 
 
SiliconShadow 
New Member 
 
  
 
Posts: 6 
Joined: Apr 2010 
 | 
| 
O.P.  RE: JIT - Debug popups
 I have cleared the precache and the error is gone. Thank you. 
 
<solved> 
 
@The above poster I am unable to edit the script it doesn't exist, so even with no scripts enabled I was getting this error, which led me to beleive it was MSN Plus however it wasn't. 
 This post was edited on 06-06-2010 at 05:25 PM by SiliconShadow.
 |   
 | 
 
| 06-06-2010 05:23 PM | 
 | 
 
  | 
 
| 
Pages: (2): 
« First
  
 [ 1 ]
 2
 
»
 
Last »
 | 
 
| 
 |  
 
 |