|
static DWORD CALLBACK
MyStreamInCallback (DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
{
CFile * pFile = (CFile *) dwCookie;
* pcb = pFile-> Read (pbBuff, cb);
return 0;
}
static DWORD CALLBACK
MyStreamOutCallback (DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
{
CFile * pFile = (CFile *) dwCookie;
// pbBuff is what you want
return 0;
}
void CAboutDlg :: OnButton1 ()
{
CFile cFile (TEXT ("myfile.rtf"), CFile :: modeRead);
EDITSTREAM esin, esout;
CRichEditCtrl m_richedit;
Ranch
m_richedit.Create (
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE,
CRect (10,10,100,200), this, 1);
Ranch
esin.dwCookie = (DWORD)&cFile;
esin.pfnCallback = MyStreamInCallback;
m_richedit.StreamIn (SF_RTF, esin);
Ranch
esout.dwCookie = (DWORD)&cFile;
esout.pfnCallback = MyStreamOutCallback;
m_richedit.StreamOut (SF_TEXT, esout);
} |
|