分类: C/C++
2012-01-30 20:23:48
CEdit *pEt = (CEdit *)GetDlgItem(IDC_EDIT_RECV);
//方式1
int nLen = GetWindowTextLength(pEt->m_hWnd);
pEt->SetSel(nLen, nLen);
pEt->ReplaceSel("要添加的文字");
//方式2
::SendMessage(GetDlgItem(hwnd,IDC_EDIT_RECV),EM_SETSEL,-1,0);
::SendMessage(GetDlgItem(hwnd,IDC_EDIT_RECV),EM_REPLACESEL,false,(long)buffer);
//方式3
CString str="append/r/n";
int nLength=pEt->SendMessage(WM_GETTEXTLENGTH);
pEt->SetSel(nLength,nLength);
pEt->ReplaceSel(str);
//自动滚屏
pEt->LineScroll(pEt->GetLineCount());