هذا قد يعمل من أجل تحميل ملف في ال rich edit
وهو مأخوذ من ال MSDN ..
كود
// 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);
هناك كود آخر أيضا أسهل .. إذا كنت تستخدم ال CRichEditView ..
إذا كنت مهتم أيضا .. أنا كنت مسوي كلاس من أجل ال Rich Edit v2.0 وهي أجدد من التي تستخدم في Visual Studio 6.0