Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clipping Suggestions? *Urgent*

Status
Not open for further replies.

rjr9999

Programmer
Apr 7, 2001
183
US
I need to display text recieved through a telnet session in a fast manner. As of right now I can format the text according to ansi escape codes (I used string mapping, for those curious) extreamly quickly, and push it into a text box quickly. The problem is, as the text box fills up, the display slows down. Does anyone have any suggestions on how I could go about clipping the text, and buffering the last 10000 characters? ie. if the buffer is full;

offset = (Ubound(buf1) - MaxBuf)
for i = LBound(buf1) to offset
buf(i) = buf(offset + i)
next i

Or something along those lines...but of corse, that wouldn't exactly be fast. I'm open to any other suggestions.

Thanks, Rob
"Programming is like art...It makes me feel like chopping my ear off."

- Currently down
 
Hi Rob,

I'm not sure extactly what you are looking for, but the fastest way of handling strings in VB is to manipulate the Safearray structure to create a byte array of the string data, without actually moving the data in memory.
thread222-258553 is a discussion of the speed of different methods of adding data to a textbox. My suggestion is slightly faster than the 'Doubling the array size' - but by far also the most complicated. Consider if it is actually worth it (change language? c++?)
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
You may find that setting the text box visible to false before you change its contents and then true after speeds it up.
Francis
 
sunaj yes I'm currently useing the a SafeArrayHeader meathod to trim the escape codes from incomeing data and then push it character by character to the text box. This isn't where I'm loseing speed though, in fact it's VERY fast. The problem arises when i do textbox.selstart = 65000 when the textbox has a large amount in it. The larger the amount, the slower it is to display. One meathod I tried is to stick everything into a buffer at the same time and do; right(buffer, max_text) which is fine and dandy if max_test is less than 2000 (because we all know right() is SLOW), then the other problem is recycling the buffer to only contain the last max_buffer (say 10000) worth of data without haveing to use slow functions like the one listed above. Of corse, I also now realize another problem that will hit me in the face when I try to interpret the escape codes to display color...VB's standard text box and rich text box do not have a fast meathod to just say print(char, color), i'll actuall have to stick the text in there, move to it, color it, and move back to the end of the text....I think I'm going to need a different meathod alltogether. Do you happen to know if VB has the capability to do low level text printing? For example -
print(char as string, color as int, xCord as int, yCord as int)...is this even possible with VB? Rob
"Programming is like art...It makes me feel like chopping my ear off."

- Currently down
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top