edit控件的ReplaceSel()会不会清内存?
例如:
我之前有很多数据
m_Edit.SetSel(0,-1);//全选
m_Edit.ReplaceSel("");//
之前分配的内存空间会不会随着ReplaceSel变小?

解决方案 »

  1.   

    void ReplaceSel(LPCTSTR lpszNewText,BOOL bCanUndo=False);
    调用此成员函数将编辑控件中的当前选定部分替换为由lpszNewText指定的文本。
    内存的话应该不会减少
      

  2.   

    设置Edit控件的风格为multiline edit control ,并且增加上DS_LOCALEDIT style 
    可以自己维护Edit控件文体缓冲区
    具体步骤如下
     
      1。Obtain a new buffer (and buffer handle) by calling LocalAlloc. 
      2。Give the buffer handle to the system by sending the control an EM_SETHANDLE 
      message
      3。Retrieve the handle of the memory currently allocated for the text in a 
         multiline edit control by sending the control an EM_GETHANDLE message. 
      4。Free the buffer by calling the LocalFree function
    其他参考msdn Allocating a Text Buffer