光标定位问题? 在EDIT BOX中有一个字符串Q2345ETEWE%%R,如何使光标定位在任意字符比如3后面,使得程序一执行,不用单击鼠标,即可在3后插入字符? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDIT1); pEdit->SetFocus(); pEdit->SetSel(3, 3, FALSE); Sorry,看作题了,改正: CString strInsert = "!!!"; CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDIT1); int nStart, nEnd; pEdit->GetSel(nStart, nEnd); CString strEdit, strLeft, strRight; pEdit->GetWindowText(strEdit); strLeft = strEdit.Left(nStart); strRight = strEdit.Right(strEdit.GetLength()-nEnd); strEdit = strLeft+ strInsert + strRight; pEdit->SetWindowText(strEdit); pEdit->SetFocus(); pEdit->SetSel(strLeft.GetLength(), strLeft.GetLength()+strInsert.GetLength(), FALSE); 各位学MFC都是怎么走到今天的? VC程序错误 CListCtrl控件无法显示大容量图片的缩略图问题 关于 IDataObject 接口的问题 视图中如何实现控件拖动及属性修改? 怎么在MSDN2003中没有vc的帮助啊? 服务器设计方案 初学VC,怎样实现折线的绘图。。。。 #include 的问题 属性页问题? 救命阿。。。。装了vc wo我的系统有问题了啊 懂安装Microsoft Visual Studio 7.0的高手请进
pEdit->SetFocus();
pEdit->SetSel(3, 3, FALSE);
CString strInsert = "!!!"; CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
int nStart, nEnd;
pEdit->GetSel(nStart, nEnd);
CString strEdit, strLeft, strRight;
pEdit->GetWindowText(strEdit);
strLeft = strEdit.Left(nStart);
strRight = strEdit.Right(strEdit.GetLength()-nEnd);
strEdit = strLeft+ strInsert + strRight;
pEdit->SetWindowText(strEdit);
pEdit->SetFocus();
pEdit->SetSel(strLeft.GetLength(), strLeft.GetLength()+strInsert.GetLength(), FALSE);