CFile file(sFileName, CFile::modeRead);
EDITSTREAM stream;
stream.dwCookie = (DWORD)&file;
stream.pfnCallback = ReadFileCallBack;
GetRichEditCtrl().StreamIn(SF_TEXT, stream);这么写就死掉了,保存为纯文本的时候就可以,什么地方写错了么?

解决方案 »

  1.   

    用RichEdit控件的时候没问题,这是什么原因?
      

  2.   

    // My callback procedure that writes the rich edit control contents
    // to a file.
    static DWORD CALLBACK 
    MyStreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
    {
       CFile* pFile = (CFile*) dwCookie;   *pcb = pFile->Read(pbBuff, cb);   return 0;
    }// The example code.
       // The pointer to my rich edit control.
       extern CRichEditCtrl* pmyRichEditCtrl;
       // The file from which to load the contents of the rich edit control.
       CFile cFile(TEXT("myfile.rtf"), CFile::modeRead);
       EDITSTREAM es;   es.dwCookie = (DWORD) &cFile;
       es.pfnCallback = MyStreamInCallback; 
       pmyRichEditCtrl->StreamIn(SF_RTF, es);
      

  3.   

    没有分了,接着这个问题问一下,richedit怎么实现多步撤消呢?
    SendMessage(EM_SETUNDOLIMIT,100,0);返回的值总是1,这是为什么?