CRichEditCtrl::StreamIn, CRichEditCtrl::StreamOut use to
write/read the contents of CRichEditCtrl object to/from the specified output stream
Example of StreamIn
<MSDN>
Example
// 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(
<MSDN>
Example of StreamOut
<MSDN>
Example
// My callback procedure that reads the rich edit control contents
// from a file.
static DWORD CALLBACK
MyStreamOutCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CFile* pFile = (CFile*) dwCookie;
pFile->Write(pbBuff, cb);
*pcb = cb;
return 0;
}
// The example code.
// The pointer to my rich edit control.
extern CRichEditCtrl* pmyRichEditCtrl;
// The file to store the contents of the rich edit control.
CFile cFile(TEXT("myfile.rtf"), CFile::modeCreate|CFile::m
EDITSTREAM es;
es.dwCookie = (DWORD) &cFile;
es.pfnCallback = MyStreamOutCallback;
pmyRichEditCtrl->StreamOut
<MSDN>
Main Topics
Browse All Topics





by: GloriousRainPosted on 2001-06-12 at 19:31:28ID: 6184255
Hi zitt,
If you want to put a text in the current active view, you have to override OnDraw function of CRichMFCView and use CDC::TextOut to do.
ex:
void CRichMFCView::OnDraw(CDC* pDC)
{
CRichMFCDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDC->TextOut(0,0, "Your text");
}
To override OnDraw function right click in CRichMFCView in workspace view->select Add virtual function..->one popup window appears->select Add Handler for OnDraw in "New Virtual Functions" list