PDA

View Full Version : Hosts File Help!



abnrange
03-01-2010, 12:34 PM
Trying to creata a simple app that will open a text file that hosts file entry that will load into input1. Once loaded you can add, delete etc... My attached project allows me to delete but, not manually type anything into the input object. Not sure why this is not working when it works in another project. Can someone explain to me what I did wrong? Thanks

Scriptonite
03-01-2010, 05:50 PM
I'm going to go out on a limb here and say it looks like you have too much text in your input object and it is not allowing you to add any more text.

abnrange
03-01-2010, 08:35 PM
So, the input object has a limited amount of text that can be edited? Good to know - Thanks

Imagine Programming
03-01-2010, 10:34 PM
So, the input object has a limited amount of text that can be edited? Good to know - Thanks

The max number of allowed characters could be something containing a 3... I can't remember at all XD But could it be 32000 characters? or 320000?

RizlaUK
03-02-2010, 04:30 AM
the default length is 30,000 chars, but you can change this to whatever you want, use "SendMessageA" with "EM_SETLIMITTEXT" and "EM_GETLIMITTEXT"

EG:

EM_GETLIMITTEXT = 213
EM_SETLIMITTEXT = 197

function Input.GetMaxLen(sObject)

local tProps = Input.GetProperties(sObject);
if tProps then
local result = DLL.CallFunction("User32.dll", "SendMessageA", tProps.WindowHandle..","..EM_GETLIMITTEXT..",0,0", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
return result
else
return 0
end

end

function Input.SetMaxLen(sObject, nLen)

local tProps = Input.GetProperties(sObject);
if tProps then
DLL.CallFunction("User32.dll", "SendMessageA", tProps.WindowHandle..","..EM_SETLIMITTEXT..","..nLen..",0", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
end

end

Input.SetMaxLen("Input1",100000000)


Easy :yes

RizlaUK
03-02-2010, 04:53 AM
here, your APZ works now :yes

abnrange
03-02-2010, 07:34 AM
Thanks RizlaUK!!! Works great!!!!

Scriptonite
03-02-2010, 03:02 PM
Nice work around Riz, thanks for posting that.