RichEdit
时间:2010-06-08 来源:yf956613
// [6/8/2010 yangfeng] 用消息实现全选
//CHARRANGE cr;
//cr.cpMin = 0;
//cr.cpMax = -1;
//::SendMessage(m_RichEdit.m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr);
// [6/8/2010 yangfeng] 用消息实现全选
// [6/8/2010 yangfeng] 用消息实现查找
FINDTEXTEX Front,Behind;
Front.chrg.cpMin = 0;
Front.chrg.cpMax = -1;
Front.lpstrText = _T("<"); Behind.chrg.cpMin = 0;
Behind.chrg.cpMax = -1;
Behind.lpstrText = _T(">"); ::SendMessage(m_RichEdit.m_hWnd, EM_FINDTEXTEX,FR_DOWN,(LPARAM)&Front);
::SendMessage(m_RichEdit.m_hWnd, EM_FINDTEXTEX,FR_DOWN,(LPARAM)&Behind);
CHARRANGE cr = {0};
cr.cpMin = Front.chrgText.cpMin;
cr.cpMax = Behind.chrgText.cpMax;
::SendMessage(m_RichEdit.m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr);
m_RichEdit.SetFocus();
//CHARRANGE cr;
//cr.cpMin = 0;
//cr.cpMax = -1;
//::SendMessage(m_RichEdit.m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr);
// [6/8/2010 yangfeng] 用消息实现全选
// [6/8/2010 yangfeng] 用消息实现查找
FINDTEXTEX Front,Behind;
Front.chrg.cpMin = 0;
Front.chrg.cpMax = -1;
Front.lpstrText = _T("<"); Behind.chrg.cpMin = 0;
Behind.chrg.cpMax = -1;
Behind.lpstrText = _T(">"); ::SendMessage(m_RichEdit.m_hWnd, EM_FINDTEXTEX,FR_DOWN,(LPARAM)&Front);
::SendMessage(m_RichEdit.m_hWnd, EM_FINDTEXTEX,FR_DOWN,(LPARAM)&Behind);
CHARRANGE cr = {0};
cr.cpMin = Front.chrgText.cpMin;
cr.cpMax = Behind.chrgText.cpMax;
::SendMessage(m_RichEdit.m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr);
m_RichEdit.SetFocus();
相关阅读 更多 +