quote:
Originally posted by win_crook
Here is the code that defines start:
code:
var EM_GETSEL = 0xB0;
var EM_SETSEL = 0xB1;
var Start = Interop.Allocate(32);
Interop.Call("user32", "SendMessageW", Wnd.GetControlHandle("NameEdit"), EM_GETSEL, Start, 0);
When you are allocating memory to a variable you cannot simply reference the variable itself. In this case the value you are trying to read is a DWORD.
You need to replace:
code:
var text = Wnd.GetControlText("NameEdit");
var firstHalf = text.substring(0, Start);
var secondHalf = text.substring(Start, before.length);
With this
code:
var text = Wnd.GetControlText("NameEdit");
var firstHalf = text.substring(0, Start.ReadDWORD(0));
var secondHalf = text.substring(Start.ReadDWORD(0), before.length);
And where does before come into play?
Also why are you allocating 32 bytes of memory to Start? It should be 4.