Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

long strings in TEDIT

Posted on 1997-04-28
12
Medium Priority
?
294 Views
Last Modified: 2013-12-04
I want to edit large files but TEdit from OWL(Pascal BP70, WIN3.11) does not want more than abaout 10 kB text.
What is wrong? I guess, that TEdit should
eat at least 64kB.

Mircea
0
Comment
Question by:nmm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 15

Accepted Solution

by:
NickRepin earned 100 total points
ID: 1396963
Use yourTEdit->SendMessage(EM_LIMITTEXT,<text_size>,0);Here is Article ID: Q89712 from MS knowledge base----------------------------------------------------------------------
The information in this article applies to:

 - Microsoft Win32 Software Development Kit (SDK)versions 3.1, 3.5,
   3.51, and 4.0
----------------------------------------------------------------------

The default maximum size for a multiline edit (MLE) control in both Windows
and Windows NT is 30,000 characters. The EM_LIMITTEXT message allows an
application to increase this value. Setting "cchmax" to 0 is a portable
method of increasing this limit to the maximum in both Windows and Windows
NT. When cchmax is set to 0, the maximum size for an MLE is 4GB-1 (4
gigabytes minus 1).

Additional reference words: 3.10 3.50 3.51 4.00 95
KBCategory: kbprg
KBSubcategory: UsrCtl
0
 
LVL 15

Expert Comment

by:NickRepin
ID: 1396964
To allow maximum text size use this:  TEdit->SendMessage(EM_LIMITTEXT,0,0);
0
 

Author Comment

by:nmm
ID: 1396965
Sorry, but this does *not* work. Dont know way....
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

Author Comment

by:nmm
ID: 1396966
It seems to me that WIN uses the local heap for my string in the TEdit. The local heap is limited to 3 kB.

0
 
LVL 15

Expert Comment

by:NickRepin
ID: 1396967
Does TEdit control have ES_MULTILINE style?1.If you use dialog resource, check if it has DS_LOCALEDIT style.
This style specifies that edit controls in the dialog box will use memory in the application's data segment. By default, all edit controls in dialog boxes use memory outside the application's data segment.2.If dialog resource has DS_LOCALEDIT style, you can tryto retrieve a handle to the memory currently allocated for a  edit control (by sending EM_GETHANDLE message) and then reallocate this memory by using the LocalReAlloc().
0
 

Author Comment

by:nmm
ID: 1396968
Hm. It not from a dialogbox. It has ES_MULTILINE.
I insert the text from a file by several em_selreplace messages.
After inserting about 3 kB it will not longer insert.
Up to now I thought, it is a restriction of the edit-class itself. Please help again!!

Mircea
0
 
LVL 15

Expert Comment

by:NickRepin
ID: 1396969
1.What textLen parameters are you using in TEdit constructor (it must be zero)?2.It seems TEdit really uses local heap. You can evaluate following code for TEdit (in place where TEdit->GetHandle() is valid, ie !=0):uint16 editDS=FP_SEG(GlobalLock((HINSTANCE)TEdit->GetWindowWord(GWW_HINSTANCE)));if(editDS==_DS) {   // Your TEdit uses local heap!   // You should increase size of local heap :( .}   
At least, you can just reject my answer.
0
 

Author Comment

by:nmm
ID: 1396970
Ok, I will check, wether it uses Local heap.
May be you have an Idea, how to get it using global one???
p.s.: I will not reject your answer, the thing with cchmax
was new for me (at least)
0
 

Author Comment

by:nmm
ID: 1396971
Hi Nick again,
yes it uses DS :(
Do you know, how to persuade it to use globalmem?
nmm
0
 
LVL 15

Expert Comment

by:NickRepin
ID: 1396972
 I am sorry, but cannot give you answer right now.  It seems if we create edit box as window by TEdit(TWindow* parent, int Id, const char far* text, int x, int y, int w, int h ...) it uses local heap. And this behavior is not property of TEdit but property of edit box itself.  I can only give you advice to use large model and to increase size of local heap.  I am using Win32. There are no such (and many other) problems in Win95/NT at all. I forgot Win 3.1 just like bad dream. 
0
 

Author Comment

by:nmm
ID: 1396973
OWL uses the procedure


function MakeObjectInstance(P: PWindowsObject): TFarProc;
const
  BlockCode: array[1..5] of Byte = (
    $5B,              { POP BX             }
    $2E, $C4, $1F,    { LES BX,CS:[BX]     }
    $EA);             { JMP FAR StdWndProc }
var
  Block: PInstanceBlock;
  Instance: PObjectInstance;
begin
  if InstFreeList = nil then
  begin
    Block := GlobalLock(GlobalAlloc(gmem_Fixed, SizeOf(TInstanceBlock)));
    Block^.Next := InstBlockList;
    Move(BlockCode, Block^.Code, 5);
    Block^.WndProcPtr := StdWndProcInstance;
    Instance := @Block^.Instances;
    repeat
      Instance^.Code := $E8;  { CALL NEAR PTR Offset }
      Instance^.Offset := (2 - 3) - PtrRec(Instance).Ofs;
      Instance^.Next := InstFreeList;
      InstFreeList := Instance;
      Inc(PtrRec(Instance).Ofs, SizeOf(TObjectInstance));
    until PtrRec(Instance).Ofs = SizeOf(TInstanceBlock);
    InstBlockList := PtrRec(Block).Seg;
    ChangeSelector(PtrRec(Block).Seg, PtrRec(Block).Seg);
  end;
  MakeObjectInstance := TFarProc(InstFreeList);
  PtrRec(Instance).Ofs := PtrRec(InstFreeList).Ofs;
  PtrRec(Instance).Seg := AllocCSToDSAlias(PtrRec(InstFreeList).Seg);
  InstFreeList := Instance^.Next;
  Instance^.ObjectPtr := P;
  FreeSelector(PtrRec(Instance).Seg);
end;

for any Window

What do you think: is the DS-use due to this alloccstodsalias?

I can up to now not switch to Win32, unfortunately...
0
 
LVL 15

Expert Comment

by:NickRepin
ID: 1396974
I think that in any case OWL uses CreateWindow() to create edit box.  Edit box created by CreateWindow() uses local heap (as we checked). Next, OWL does not change (and cannot according WinAPI docs) memory usage for edit box window. So OWL is not the source of problem. May be I am wrong.You can try to create edit box via CreateWindow() and do not use TEdit object.
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question