我得到了一个richedit的HWND(richedit在另外程序中), 但用GetLineCount啊GetLine什么的,都获不到任何内容,是怎么回事?要如何操作才能得到 richedit的文本?谢谢!

解决方案 »

  1.   

    int GetLineCount() const
    {
    ATLASSERT(::IsWindow(m_hWnd));
    return (int)::SendMessage(m_hWnd, EM_GETLINECOUNT, 0, 0L);
    }
    // NOTE: first word in lpszBuffer must contain the size of the buffer!
    int GetLine(int nIndex, LPTSTR lpszBuffer) const
    {
    ATLASSERT(::IsWindow(m_hWnd));
    return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer);
    } int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const
    {
    ATLASSERT(::IsWindow(m_hWnd));
    *(LPINT)lpszBuffer = nMaxLength;
    return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer);
    }
      

  2.   

    试了下,这些不能用,会不会我找到这个HWND不是richedit, 我看它像,但用spy++看显示的是CuteEdit, 但它的功能跟richedit一样,还可以是从什么类继承来呢? rabo(不哭死人) 说的钩子能不能解决这个问题?
      

  3.   

    楼主:CuteEdit是什么?我在google里搜了一下,但没有什么有用信息出来。
    cuteEdit的函数是与richEdit具备一样的函数吗?根据google搜到的信息好像不是这样。请给出一些关于cuteedit的信息,我们好来分析。
      

  4.   

    findWindow不能找到吗?参考这个帖子看看
    http://community.csdn.net/Expert/topic/3369/3369392.xml?temp=.4988977