Streaming in a stringvariable

Windows specific forum
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Streaming in a stringvariable

Post 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 ?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Streaming in a stringvariable

Post by PB »

Is a$=GetGadgetText(#editorgadget) too slow?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post 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.
User avatar
jqn
User
User
Posts: 97
Joined: Fri Oct 31, 2003 3:04 pm

Post 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
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

Thanks.
But the "GetGadgetText"-Command can't grab strings higher than 64KB.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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'.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post 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.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

OK. Thats an idea.

Thank you very much :-)
Post Reply