I have a RichEdit
control in my simple application that I wish to simulate a console-like display with. I want to be able to have a buffer of x
number of lines (say, 300) and whenever a line is added, I would like to also remove the oldest (top) line if the new line exceeded the threshold x
. I would also like it to automatically scroll to the bottom to display the newest line when added.
I've been using SetWindowText
with some success, however it occurs to me that there is likely a more efficient method of appending text to the end and removing text from the beginning without having to replace all of it every time. Is this true, and, if so, how might I go about it?
Also, how might I make it automatically scroll to the bottom of the window when new text is added?
This is using the Win32 API from C, and I'm not using the MFC version of RichEdit
(just using the vanilla Win32 API on XP and Vista).