看MSDN的EditStreamCallback函数说明;
下面是关键:The control calls the callback function repeatedly, transferring a portion of the data with each call. The control continues to call the callback function until one of the following conditions occurs: The callback function returns a nonzero value. 
The callback function returns zero in the *pcb parameter. 
The value returned in the *pcb parameter is less than the number of bytes requested in the cb parameter. 
An error occurs that prevents the rich edit control from transferring data into or out of itself. Examples are out-of-memory situations, failure of a system function, or the read buffer contains an invalid character. 
For a stream-in operation, the RTF code contains data specifying the end of an RTF block. 
For a stream-in operation on a single-line edit control, the callback reads in a CRLF. 

解决方案 »

  1.   

    在我的程序中,*pcb=3,cb=4094,满足了第三个条件
      

  2.   

    ahphone(阿丰),上课乱说话是不好的
    乱说话是会影响了老师讲课的情绪的,
    就算是不影响老师的情绪,
    影响到同学的听课也是不好的吗?
      

  3.   

    return 0;表示还要继续。
    return 1;表示完了!!!
    你一直return 0;当然就不停运行喽!!!
      

  4.   

    请verybigbug看看这段话:
    The callback function returns zero to indicate success.The callback function returns a nonzero value to indicate an error. If an error occurs, the read or write operation ends and the rich edit control discards any data in the pbBuff buffer. 
    如果我返回非0值,控件会清空Buffer,另外MSDN有一个例子:
    DWORD CALLBACK EditStreamCallback (DWORD dwCookie,
    LPBYTE pbBuff, LONG cb, LONG FAR *pcb)
    {
    ReadFile ((HANDLE)dwCookie, pbBuff, cb, pcb, NULL);
    if (*pcb < cb)
    return 0; // file has been fully read in
    else
    return (DWORD) *pcb; // more to read
    }
      

  5.   

    请仔细看MSDN 这一段
    The control calls the callback function repeatedly, transferring a portion of the data with each call. The control continues to call the callback function until one of the following conditions occurs: The callback function returns a nonzero value. 
    The callback function returns zero in the *pcb parameter. 
    An error occurs that prevents the rich edit control from transferring data into or out of itself. Examples are out-of-memory situations, failure of a system function, or an invalid character in the read buffer. 
    For a stream-in operation, the RTF code contains data specifying the end of an RTF block. 
    For a stream-in operation on a single-line edit control, the callback reads in an end-of-paragraph character (CR, LF, VT, LS, or PS). 有五种情况可以结束回调函数的执行。