Whenever I send text into my richedit control, I also tell it to scroll to the bottom of the richedit (if needed) so then the data is always kept up to date (within view). Now the code works, but when it scrolls you have to click on the scrollbar because the last line of text appears at the top of the richedit instead of at the bottom, which is fixed by clicking on the scrollbar. Has anyone else experienced this type of problem, or know of a fix?

Thanks

Code:
totLines = SendMessage(window, EM_GETLINECOUNT, 0, 0);
curLine = SendMessage(window, EM_GETTHUMB, 0, 0);
SendMessage(window, EM_LINESCROLL, 0, totLines - curLine);