1 Oct 2006 02:54
how to stream in rtf string of unicode
hi:
i want stream in unicode string to richedit control.when ansi,
following is right.how to modify it to adapt to unicode?
a unicode string like this:
CString s=_T("{\\rtf1\\ansi \\v [\\v0 100\\v #100#]\\v0}");
typedef struct RtfStream
{
LPTSTR pstr;
DWORD pos;
};
LONG CLearner::StreamInRTF(LPCTSTR pstrRTF)
{
// Stream in new text...
USES_CONVERSION;
// RtfStream st = { T2A((LPTSTR)pstrRTF), 0 }; // TODO: Don't
use inline conversion for large texts
RtfStream st = { (LPTSTR)pstrRTF, 0 };
EDITSTREAM es = { 0 };
es.dwCookie = (DWORD) &st;
es.dwError = 0;
es.pfnCallback = StrStreamReadCallback;
UINT uFormat = pstrRTF[0]==_T('{') ? SF_RTF : SF_TEXT;
return StreamIn(uFormat | SFF_SELECTION, es);
}
DWORD CALLBACK CLearner::StrStreamReadCallback(DWORD dwCookie,
LPBYTE pbBuff, LONG cb, LONG* pcb)
{
(Continue reading)
RSS Feed