JScript code:var length = (Interop.Call("User32.dll","SendMessageW",Edit,WM_GETTEXTLENGTH,0,0) + 1);
var Buffer = Interop.Allocate((length + 1) * 2);
var lResult = Interop.Call("User32.dll","SendMessageW",Edit,WM_GETTEXT,length,Buffer.DataPtr);
// MessageBox is a class in my script; use your AlertDialog instead
//MessageBox.Show("Copied\t: " + lResult + "\nLength\t: " + length);
Works for me.
Nb: the length variable contains (GetTextLengthResult + 1)!
This post was edited on 02-13-2010 at 08:49 AM by SmokingCookie.
quote:Originally posted by SmokingCookie
That's weird..
Could you try:
JScript code:var length = (Interop.Call("User32.dll","SendMessageW",Edit,WM_GETTEXTLENGTH,0,0) + 1);
var Buffer = Interop.Allocate((length + 1) * 2);
var lResult = Interop.Call("User32.dll","SendMessageW",Edit,WM_GETTEXT,length,Buffer.DataPtr);
// MessageBox is a class in my script; use your AlertDialog instead
//MessageBox.Show("Copied\t: " + lResult + "\nLength\t: " + length);
Works for me.
Nb: the length variable contains (GetTextLengthResult + 1)!
Didn't work at first - said "Edit" was undefined. I assumed that was the handle of the ListViewControl - WndWriterManageWindows.SendControlMessage("LstWindows", 4120, 0, 0); - but I end up with the following message:
code:Copied : 11
Length : 1
The "Copied" value is actually the length, and "Length" always returns "1" (a number, not a string - a boolean, maybe?). Any more ideas?
Actually, don't worry. I've worked it out: I had WM_GETTEXT and WM_GETTEXTLENGTH the wrong way round...
Just one last question: how can I trigger the rename box to appear, other than clicking on the entry in the ListViewControl (for example, through a right-click menu or button)?
The menu thingy is gonna be very complex. If you want an example, look at my code again. Search for "OnWndSettings_LanguageEvent_LstViewRClicked" in the same file you found the message notification event. If there's anything you need explained, I'm here.
You can get the ItemToRename value by declaring a global variable and assigning it in each list-view event. Be sure to assign it -1 when the window is destroyed.
This post was edited on 02-14-2010 at 01:50 PM by SmokingCookie.