DWORD dwSel = ((CEdit*)GetDlgItem(IDC_EDIT1))->GetSel(); ((CEdit*)GetDlgItem(IDC_EDIT1))->SetSel(dwSel, dwSel); ((CEdit*)GetDlgItem(IDC_EDIT1))->ReplaceSel(pWchar); ((CEdit*)GetDlgItem(IDC_EDIT1))->ReplaceSel(_T("\r\n"));