The following code snippet was posted by Chris Iverson on the LB forum, for those who haven't seen it there. I changed the function def to a sub. It works especially well for field values in a Cheetah dbf...
Code:
NoMainWin
textbox #m.tb, 10, 10, 100, 25
open "Textbox test" for window as #m
#m, "trapclose [quit]"
call SetTextLimit hwnd(#m.tb), 5
wait
[quit]
close #m
end
sub SetTextLimit TextBoxHwnd, Limit
CallDll #user32, "SendMessageA",_
TextBoxHwnd as ulong,_
_EM_SETLIMITTEXT as long,_
Limit as long,_
0 as long,_
SetTextLimit as long
end sub