Here's my stab at the AppendString method, combines several of the ideas from earlier comments.
// Appends a text string to the history edit control.
// This method appends a carriage return
// append a carriage return
str += "\r\n";
// always write the line at the end
int len = GetWindowTextLength();
// Algorithm for determining when and how much of the most obsolete
// text to remove. Reminds me of 1/3 1/3 1/3 rule for fuel planning in
// a power boat: 1/3 to get there, 1/3 to get back, and 1/3 reserve.
// Here, when 1/3 of the capacity of the edit control remains,
// discard the most obsolete 1/3. The most current 1/3 is never
// disturbed. GetLimitText() gets the capacity of the edit control.
// GetWindowTextLength() gets the length of the current contents.