RichEditView StreamIn Problem? 
Author Message
 RichEditView StreamIn Problem?

Can anyone tell me what is wrong with my code that follows,as am trying to
set the text in a richeditview from a menu option (just as a test)  and
StreamIn seems to give the following error:

Debug Assertion failed
Program:E:\TESTRICHEDIT.EXE
File:   arccore.cpp
Line: 628

My code is as follows:

static DWORD CALLBACK EditStreamCallBack(DWORD dwCookie, LPBYTE pbBuff, LONG
cb,
LONG *pcb){

CString *pstr = (CString *) dwCookie;
if(pstr ->GetLength() <cb){
  *pcb = pstr->GetLength();
  memcpy(pbBuff, (LPCSTR) *pstr, *pcb);
  pstr->Empty();

Quote:
}

else{
  *pcb = cb;
  memcpy(pbBuff, (LPCSTR) *pstr, *pcb);
  *pstr= pstr->Right(pstr->GetLength()-cb);

Quote:
}

return 0;

Quote:
}

void CTestRichEditView::OnTestData()
{

CRichEditCtrl*lpCtrl = (CRichEditCtrl *) &GetRichEditCtrl();

CString rtfPrefix, rtfPostfix;

rtfPrefix =  "{\\rtf1\\ansi\\deff0\\deftab720{\\fonttbl{\\f0\\froman "
"Times New Roman;}}\n{\\colortbl\\red0\\green0\\blue0;}\n"
"\\deflang1033\\pard\\tx360\\tx720\\tx1080\\tx1440\\tx1800"
"\\tx2160\\tx2520\\tx2880\\tx3240\\tx3600\\tx3960\\tx4320"
"\\tx4680\\tx5040\\tx5400\\tx5760\\tx6120"
"\\tx6480\\plain\\f3\\fs20 ";

rtfPostfix = "\n\\par }";

CString rtfString = rtfPrefix + "\\b Bold\\b0" + rtfPostfix;

EDITSTREAM es;
es.dwCookie = (DWORD) &rtfString;
es.dwError=0;
es.pfnCallback = EditStreamCallBack;

lpCtrl->StreamIn(SF_RTF |SFF_SELECTION, es);

Quote:
}

Thank you

Cecil.



Mon, 16 Jul 2001 03:00:00 GMT  
 RichEditView StreamIn Problem?
I think instead of calling your EditStreamCallBack(), it is calling the
CRichEditView::EditStreamCallBack. Because only that function has a CArchive
as part of the cookie. Are you sure your CallBack is getting called

Quote:

>Can anyone tell me what is wrong with my code that follows,as am trying to
>set the text in a richeditview from a menu option (just as a test)  and
>StreamIn seems to give the following error:

>Debug Assertion failed
>Program:E:\TESTRICHEDIT.EXE
>File:   arccore.cpp
>Line: 628

>My code is as follows:

>static DWORD CALLBACK EditStreamCallBack(DWORD dwCookie, LPBYTE pbBuff,
LONG
>cb,
>LONG *pcb){

>CString *pstr = (CString *) dwCookie;
>if(pstr ->GetLength() <cb){
>  *pcb = pstr->GetLength();
>  memcpy(pbBuff, (LPCSTR) *pstr, *pcb);
>  pstr->Empty();
>}
>else{
>  *pcb = cb;
>  memcpy(pbBuff, (LPCSTR) *pstr, *pcb);
>  *pstr= pstr->Right(pstr->GetLength()-cb);
>}

>return 0;
>}

>void CTestRichEditView::OnTestData()
>{

>CRichEditCtrl*lpCtrl = (CRichEditCtrl *) &GetRichEditCtrl();

>CString rtfPrefix, rtfPostfix;

>rtfPrefix =  "{\\rtf1\\ansi\\deff0\\deftab720{\\fonttbl{\\f0\\froman "
>"Times New Roman;}}\n{\\colortbl\\red0\\green0\\blue0;}\n"
>"\\deflang1033\\pard\\tx360\\tx720\\tx1080\\tx1440\\tx1800"
>"\\tx2160\\tx2520\\tx2880\\tx3240\\tx3600\\tx3960\\tx4320"
>"\\tx4680\\tx5040\\tx5400\\tx5760\\tx6120"
>"\\tx6480\\plain\\f3\\fs20 ";

>rtfPostfix = "\n\\par }";

>CString rtfString = rtfPrefix + "\\b Bold\\b0" + rtfPostfix;

>EDITSTREAM es;
>es.dwCookie = (DWORD) &rtfString;
>es.dwError=0;
>es.pfnCallback = EditStreamCallBack;

>lpCtrl->StreamIn(SF_RTF |SFF_SELECTION, es);

>}

>Thank you

>Cecil.



Mon, 16 Jul 2001 03:00:00 GMT  
 RichEditView StreamIn Problem?
No I'm not 100% sure could you tell me how I could fix or check this.

Thank you

Cecil

Quote:

>I think instead of calling your EditStreamCallBack(), it is calling the
>CRichEditView::EditStreamCallBack. Because only that function has a
CArchive
>as part of the cookie. Are you sure your CallBack is getting called


>>Can anyone tell me what is wrong with my code that follows,as am trying to
>>set the text in a richeditview from a menu option (just as a test)  and
>>StreamIn seems to give the following error:

>>Debug Assertion failed
>>Program:E:\TESTRICHEDIT.EXE
>>File:   arccore.cpp
>>Line: 628

>>My code is as follows:

>>static DWORD CALLBACK EditStreamCallBack(DWORD dwCookie, LPBYTE pbBuff,
>LONG
>>cb,
>>LONG *pcb){

>>CString *pstr = (CString *) dwCookie;
>>if(pstr ->GetLength() <cb){
>>  *pcb = pstr->GetLength();
>>  memcpy(pbBuff, (LPCSTR) *pstr, *pcb);
>>  pstr->Empty();
>>}
>>else{
>>  *pcb = cb;
>>  memcpy(pbBuff, (LPCSTR) *pstr, *pcb);
>>  *pstr= pstr->Right(pstr->GetLength()-cb);
>>}

>>return 0;
>>}

>>void CTestRichEditView::OnTestData()
>>{

>>CRichEditCtrl*lpCtrl = (CRichEditCtrl *) &GetRichEditCtrl();

>>CString rtfPrefix, rtfPostfix;

>>rtfPrefix =  "{\\rtf1\\ansi\\deff0\\deftab720{\\fonttbl{\\f0\\froman "
>>"Times New Roman;}}\n{\\colortbl\\red0\\green0\\blue0;}\n"
>>"\\deflang1033\\pard\\tx360\\tx720\\tx1080\\tx1440\\tx1800"
>>"\\tx2160\\tx2520\\tx2880\\tx3240\\tx3600\\tx3960\\tx4320"
>>"\\tx4680\\tx5040\\tx5400\\tx5760\\tx6120"
>>"\\tx6480\\plain\\f3\\fs20 ";

>>rtfPostfix = "\n\\par }";

>>CString rtfString = rtfPrefix + "\\b Bold\\b0" + rtfPostfix;

>>EDITSTREAM es;
>>es.dwCookie = (DWORD) &rtfString;
>>es.dwError=0;
>>es.pfnCallback = EditStreamCallBack;

>>lpCtrl->StreamIn(SF_RTF |SFF_SELECTION, es);

>>}

>>Thank you

>>Cecil.



Tue, 17 Jul 2001 03:00:00 GMT  
 RichEditView StreamIn Problem?
Thank you as I altered my EditStreamCallBack name and it work correctly.

Cecil.

Quote:

>I think instead of calling your EditStreamCallBack(), it is calling the
>CRichEditView::EditStreamCallBack. Because only that function has a
CArchive
>as part of the cookie. Are you sure your CallBack is getting called


>>Can anyone tell me what is wrong with my code that follows,as am trying to
>>set the text in a richeditview from a menu option (just as a test)  and
>>StreamIn seems to give the following error:

>>Debug Assertion failed
>>Program:E:\TESTRICHEDIT.EXE
>>File:   arccore.cpp
>>Line: 628

>>My code is as follows:

>>static DWORD CALLBACK EditStreamCallBack(DWORD dwCookie, LPBYTE pbBuff,
>LONG
>>cb,
>>LONG *pcb){

>>CString *pstr = (CString *) dwCookie;
>>if(pstr ->GetLength() <cb){
>>  *pcb = pstr->GetLength();
>>  memcpy(pbBuff, (LPCSTR) *pstr, *pcb);
>>  pstr->Empty();
>>}
>>else{
>>  *pcb = cb;
>>  memcpy(pbBuff, (LPCSTR) *pstr, *pcb);
>>  *pstr= pstr->Right(pstr->GetLength()-cb);
>>}

>>return 0;
>>}

>>void CTestRichEditView::OnTestData()
>>{

>>CRichEditCtrl*lpCtrl = (CRichEditCtrl *) &GetRichEditCtrl();

>>CString rtfPrefix, rtfPostfix;

>>rtfPrefix =  "{\\rtf1\\ansi\\deff0\\deftab720{\\fonttbl{\\f0\\froman "
>>"Times New Roman;}}\n{\\colortbl\\red0\\green0\\blue0;}\n"
>>"\\deflang1033\\pard\\tx360\\tx720\\tx1080\\tx1440\\tx1800"
>>"\\tx2160\\tx2520\\tx2880\\tx3240\\tx3600\\tx3960\\tx4320"
>>"\\tx4680\\tx5040\\tx5400\\tx5760\\tx6120"
>>"\\tx6480\\plain\\f3\\fs20 ";

>>rtfPostfix = "\n\\par }";

>>CString rtfString = rtfPrefix + "\\b Bold\\b0" + rtfPostfix;

>>EDITSTREAM es;
>>es.dwCookie = (DWORD) &rtfString;
>>es.dwError=0;
>>es.pfnCallback = EditStreamCallBack;

>>lpCtrl->StreamIn(SF_RTF |SFF_SELECTION, es);

>>}

>>Thank you

>>Cecil.



Tue, 17 Jul 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. RichEditView StreamIn Problem?

2. CRichEditCntrl StreamIn Problem

3. Problem with CRichEditCtrl StreamIn function...

4. RichEditView Read Only Caret Problem?

5. Problem with Set Text Format in RichEditView class

6. RichEditView Printing Problem using RICHED20.dll!!!!

7. RichEditView Read Only Caret Problem?

8. I Have some problems...Please HELP ME!!!(Insert ITEM in RichEditView)

9. The Non-appearing RichEditView Scrollbar Problem

10. Rich Text StreamIn with images

11. Bug with CRichEditCtrl StreamIn callback function?

12. Help: CRichEditCtrl and StreamIn?

 

 
Powered by phpBB® Forum Software