coincedentally, i just used the same idea to stop my IRC client draining cpu time - it has a thread with an infinite for loop, and if the text output box isn't too big, it will just cancel and sleep for a few milliseconds;
CODE
DWORD WINAPI Manage_Text (LPVOID n)
{
for (;;)
{
nLength = GetWindowTextLength (hWndEdit_Output);
if (nLength > 15000)
{
int nLine;
nLine = (int) SendMessage (hWndEdit_Output, EM_LINEINDEX, (WPARAM) 32, (LPARAM) NULL);
SendMessage (hWndEdit_Output, EM_SETSEL, (WPARAM) 0, (LPARAM) nLine);
SendMessage (hWndEdit_Output, EM_REPLACESEL, (WPARAM) FALSE, (LPARAM) NULL);
nLength = GetWindowTextLength (hWndEdit_Output);
SendMessage (hWndEdit_Output, EM_LINESCROLL, (WPARAM) NULL, (LPARAM) nLength);
}
else
{
Sleep (1);
}
}
//the nLength changed because the function concatenated strings;
return (DWORD) n;
}