效果
代码
void CMyDlg::OnButton1()
{
// TODO: Add your control notification handler code here
//IDC_EDIT1
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
int nLength = pEdit->GetWindowTextLength();
pEdit->SetSel(nLength,nLength);
pEdit->ReplaceSel(_T("ABC2"));
}