CEditView 可以用 CWnd::GetWindowText 得到全文本
          也可以 CEdit::GetLine 得到当前行文本那么,我需要获得 某个 position 后的所有文本,还有没有更好的策略?目标:节约内存,速度等。

解决方案 »

  1.   

    SetSel(); 此成员函数在一个编辑控件中选择一定范围的字符选中以后再用Copy到剪切板。不知道这样是否可以?
      

  2.   

    这个方法   i fu了 you
      

  3.   

    例如:取得CEdit的前20个字符。INT    nStart = 0;
    INT    nEnd   = 20;
    TCHAR* buffer = new TCHAR[21];
    ::SendMessage( m_CEdit.m_hWnd, EM_SETSEL, nStart, nEnd );
    ::SendMessage( m_CEdit.m_hWnd, EM_GETSELTEXT, 0, buffer );
      

  4.   

    楼上的方法for rich edit不过楼上的方法可以用吧。。没试过The EM_GETSELTEXT message retrieves the currently selected text in a rich edit control.EM_GETSELTEXT 
    wParam = 0; 
    lParam = (LPARAM) (LPSTR) lpBuf; 
     
    Parameters
    lpBuf 
    Pointer to a buffer that receives the selected text. The calling application must ensure that the buffer is large enough to hold the selected text. 
    Return Values
    Returns the number of characters copied, not including the terminating null character.
      

  5.   

    i choose:
    SetSel()
    Copy()
      

  6.   

    一般地说:EditBox用EM_SETSEL,RichEditBox用EM_EXSETSEL。
    EM_GETSELTEXT可以通用。