版权声明:本文为博主原创文章,未经博主允许不得转载。
- // MFC 版本
- CEdit* pEdit = GetDlgItem(IDC_EDIT1);
- ASSERT(pEdit && pEdit->GetSafeHwnd());
- pEdit->SetSel(-1);
- pEdit->ReplaceSel(_T("Hello, World!"));
- // SDK 版本
- HWND hEdit = ::GetDlgItem(hWnd, IDC_EDIT1);
- ASSERT(hEdit);
- ::SendMessage(hEdit, EM_SETSEL, LOWORD(-1), HIWORD(-1));
- ::SendMessage(hEdit, EM_REPLACESEL, 0, (LPARAM)(_T("Hello, World!")));
http://blog.csdn.net/visualeleven/article/details/6049471