CChatView应该是从CRichEditView派生的吧?
int len = GetWindowTextLength();得到文本的长度,也就是末尾的位置;
GetEditCtrl().SetSel(len,len);将当前光标移到文本的末尾;
GetEditCtrl().ReplaceSel(strTemp);在文本末尾增加字符串strTemp;
这三个函数的作用就是在一段文本的末尾增加一个字符串

解决方案 »

  1.   

    请问: kuhaha() 
    GetWindowTextLength()
    操作的对象是谁!
      

  2.   

    "\r\n"表示回车,SetSel(len,len);选择了文件末尾,因此,ReplaceSel就把回车加到了文件末尾
      

  3.   

    int len = GetWindowTextLength();得到字符串长度
    GetEditCtrl().SetSel(len,len);将光标移到串的末尾
    GetEditCtrl().ReplaceSel(strTemp);加上回车换行
      

  4.   

    int len = GetWindowTextLength();这一行应该写成
    int len=GetEditCtrl().GetWindowTextLength();这样就可以理解了。