参考
// function to stream the RTF string out of the rich edit control.
DWORD CALLBACK CBStreamOut(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
// Address of our string var is in psEntry
CString *pStr = (CString*) dwCookie;
*pStr += CString(pbBuff).Left(cb);
return 0;
}
//SF_TEXT SF_RTF
BOOL CPeekCommDlg::GetRTF(CString &str)
{
// Return the RTF string of the text in the control.
EDITSTREAM es;
es.dwError = 0;
es.pfnCallback = CBStreamOut;// Set the callback
es.dwCookie = (DWORD) &str; // receives the string
// get all ; "|SFF_SELECTION"
LONG all=m_RichEdit.StreamOut(SF_RTF, es);
// afxDump << all <<"\r\n";
return TRUE;
}