// 0x0118这个消息是MS未文档化的消息WM_SYSTIMER (caret blink) BOOL CXXDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT1); ASSERT(pEdit); if((0x0118 == pMsg->message) && (pMsg->hwnd == pEdit->GetSafeHwnd())) { int start = 0; int end = 0; pEdit->GetSel(start, end); if(start != end) { CPoint pt; GetCursorPos(&pt); pEdit->ScreenToClient(&pt); int nSel = LOWORD(pEdit->CharFromPos(pt)); pEdit->SetSel(nSel, nSel); } } return CDialog::PreTranslateMessage(pMsg); }
取消用鼠标拖动或者用键盘在编辑框中选择的文本内容
猜你喜欢
转载自blog.csdn.net/visualeleven/article/details/7317840
今日推荐
周排行