Page 1 of 1

Streaming in a stringvariable

Posted: Mon Jun 27, 2005 12:01 pm
by Hroudtwolf
Hello ,


I need a very fast way to copy the whole text in an editorgadget in a stringvariable.
Do anyone knows, how to do it ?

Re: Streaming in a stringvariable

Posted: Mon Jun 27, 2005 12:12 pm
by PB
Is a$=GetGadgetText(#editorgadget) too slow?

Posted: Mon Jun 27, 2005 12:23 pm
by Hroudtwolf
Not to slow. But I need to copy bigger texts than 64Kb.
The only way to the solution is to stream it out.
But I don't know how.

Posted: Mon Jun 27, 2005 12:42 pm
by jqn
Hi,
Increment Size of a String:

Code: Select all

Procedure SetStringManipulationBufferSize(Bytes)
  PBStringBase.l = 0
  PBMemoryBase.l = 0
  !MOV eax, dword [PB_StringBase]
  !MOV [esp+4],eax
  !MOV eax, dword [PB_MemoryBase]
  !MOV [esp+8],eax
  HeapReAlloc_(PBMemoryBase, #GMEM_ZEROINIT, PBStringBase, Bytes)
  !MOV dword [_PB_StringBase],eax
EndProcedure
It's copied from any thread, I don't remember, but it work.

JOAQUIN

Posted: Mon Jun 27, 2005 12:53 pm
by Hroudtwolf
Thanks.
But the "GetGadgetText"-Command can't grab strings higher than 64KB.

Posted: Mon Jun 27, 2005 1:05 pm
by gnozal
Look in Win32.hlp, search for EM_STREAMIN.
There is an example in the purebasic editor sources ( file 'Purebasic Ide.pb' at http://cvs.purebasic.com/ ), search for 'stream'.

Posted: Mon Jun 27, 2005 1:22 pm
by Hroudtwolf
EM_StreamIn is for send a string to the editor.
I need a function to read big textes very fast FROM an editorgadget into a variable.

Posted: Mon Jun 27, 2005 1:48 pm
by gnozal
:oops: I guess I didn't read carrefully enough ...
If you want to read big textes into a variable, you will always have the string limitation problem ; why not use a memory buffer and the #WM_GETTEXT or #EM_GETSELTEXT messages ?

Code: Select all

; Something like this :
*TextBuffer = LocalAlloc_(#LMEM_ZEROINIT, NumberOfCaractersToCopy+1)
SendMessage_(RichEditGadgetHandle, #WM_GETTEXT, NumberOfCaractersToCopy+1, *TextBuffer)

Posted: Mon Jun 27, 2005 1:56 pm
by Hroudtwolf
OK. Thats an idea.

Thank you very much :-)