Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

efficient streaming of rich text to/from Cricheditctrl

Status
Not open for further replies.

serpem

Programmer
Feb 20, 2003
22
0
0
US
I need to move text back and forth between a rich edit view and a CString variable. I am using the following callback functions:
DWORD __stdcall StreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CString *psBuffer = (CString *)dwCookie;
if (cb > psBuffer->GetLength())
cb = psBuffer->GetLength();
memcpy(pbBuff, psBuffer->GetBuffer(cb), cb);
*pcb = cb;
*psBuffer = psBuffer->Mid(cb);
return 0;
}
DWORD __stdcall StreamOutCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CString sThisWrite;
sThisWrite.GetBufferSetLength(cb);
CString *psBuffer = (CString *)dwCookie;
memcpy(sThisWrite.GetBuffer(cb), pbBuff, cb);
*psBuffer += sThisWrite;
*pcb = sThisWrite.GetLength();
sThisWrite.ReleaseBuffer();
return 0;
}
they work fine in general but the only problem is when the rich edit view has several objects (like 5 images for examples), the process becomes very slow and almost impractical. so I am wondering if someone has either a better implementation of such callback, or a different method of doing what I am trying to do? thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top