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.
Create a Local variable, but using #STACK to make sure the SUB stack is large enough to hold the REBuffer.
In this last option, I could also use a string value, with some variation on this:
Is there a common approach to this problem?
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)
Comment