先呼叫 GetWindowTextLength(), 再利用 SetSel 將 caret (文字游標) 移動到最後, 再利用 ReplaceSel 將要新增的文字加入即可, 範例程式如下,
代碼: 選擇全部
int len = m_log.GetWindowTextLength();
m_log.SetSel(len, len, true);
m_log.ReplaceSel(lpszNewText);
上面的 m_log 為一 CEdit Control