Re: NO Bug in CRichEditCtrl::GetLine()

"hawkgao" <hawkgao-/[email protected]>
Newsgroups gmane.comp.windows.wtl
Message-ID <[email protected]>
;P. i got it. and i also know why i get part of line text by another GetLine(). because the first WORD of this buffer may not be cleaned. it has random value.

--- In [email protected], "Alain Rist" <ar@...> wrote:
>
> Try with 65535 and guess why it will work :)
> 
> 
>   ----- Original Message ----- 
>   From: hawkgao 
>   To: [email protected] 
>   Sent: Monday, March 09, 2009 8:47 AM
>   Subject: Re: [wtl]NO Bug in CRichEditCtrl::GetLine()
> 
> 
>   I have tried this member function. I use a 65536 TCHARes long buffer. it returned an empty line to me. nothing can be gotten.
> 
>   --- In [email protected], "Alain Rist" <ar@> wrote:
>   >
>   > In the doc for EM_GETLINE:
>   > 'Before sending the message, set the first word of this buffer to the size, in TCHARs, of the buffer.'
>   > 
>   > 
>   > ----- Original Message ----- 
>   > From: hawkgao 
>   > To: [email protected] 
>   > Sent: Monday, March 09, 2009 7:13 AM
>   > Subject: [wtl] Bug Report, in CRichEditCtrl::GetLine()
>   > 
>   > 
>   > int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const
>   > {
>   > ATLASSERT(::IsWindow(m_hWnd));
>   > *(LPWORD)lpszBuffer = (WORD)nMaxLength; //WRONG! assign length to buffer address variable.
>   > return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer);
>   > }
>   > 
>   > 
>   > 
>   > 
>   > [Non-text portions of this message have been removed]
>   >
> 
> 
>   
> 
> [Non-text portions of this message have been removed]
>




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.