Maybe this will be of help? or Maybe not
RTF made Easy for RichEdit
Announcement
Collapse
No announcement yet.
Best way to set RichEdit text buffer?
Collapse
X
-
The best (and proper IMO) way to set and get text with a RichEdit control is to use the following messages:
EM_STREAMIN
EM_STREAMOUT
Do a search of the forums for examples.
These commands allow you to move very large blocks of text (in the megabytes), to move only selected portions of the text (what is selected or highlighted) and to move text in either ascii or RTF (RichText Format).
If you want to get the most out of the RichEdit control start learning how to use these messages.
Leave a comment:
-
Code:Buffer$= STRING$(BufferSize&,0) GLOBAL MEM ALLOC Buffersize& to hMem pBuff = malloc(size) ' note 1 REDIM buff(BufferSize& -1) AS BYTE LOCAL|STATIC\GLOBAL|THREADED Buffer AS STRING * %Buffersize [ or AS ASCIIZ * %BUffersize + 1)
Leave a comment:
-
Best way to set RichEdit text buffer?
Since a user can select the entire text within a RichEdit control, capturing the selected text means I have to provide a buffer larger enough to hold the maximum amount of text the RE can hold. In my app, I've set that using EM_LIMITTEXT to 1MB.
My question is what is the best way to provide the appropriately sized buffer. In most of the examples I've seen, the buffer sizes are relatively small - I haven't seen an example with a huge buffer size.
The two methods I've considered are:
Create a global buffer variable using the RE size limit (should be slightly bigger, I suppose). No #STACK required. Global variable size limits are huge.
Code:#Compile Exe #Dim All %RELimit = &H100000& Global REBuffer As Asciiz * %RELimit Function PBMain () As Long ... End Function
Code:#Compile Exe #Dim All #Stack &H200000& 'something bigger than REBuffer %D = &H100000& Function PBMain () As Long Call MySub End Function Sub MySub Local REBuffer As Asciiz * %D ... End Sub
Code:Local sBuffer As String sBuffer = Space$(%D) + Chr$(0)
Leave a comment: