DWORD __stdcall MEditStreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CString *psBuffer = (CString *)dwCookie; if (cb > psBuffer->GetLength()) cb = psBuffer->GetLength(); for (int i=0;i<cb;i++) {
*(pbBuff+i) = psBuffer->GetAt(i);
} *pcb = cb; *psBuffer = psBuffer->Mid(cb); return 0;
} {
CString strAAA, strBBB; //输出文字"..."RTF格式(AAA)
EDITSTREAM es;
es.dwCookie = (DWORD)&strAAA; // Pass a pointer to the CString to the callback function
es.pfnCallback = MEditStreamInCallback; // Specify the pointer to the callback function
// Function defined in RichEg.cpp
m_richedit.StreamIn(SF_RTF, es); //输出文字"..."RTF格式(BBB)
EDITSTREAM es;
es.dwCookie = (DWORD)&strBBB; // Pass a pointer to the CString to the callback function
es.pfnCallback = MEditStreamInCallback; // Specify the pointer to the callback function
// Function defined in RichEg.cpp m_richedit.StreamIn(SF_RTF, es);
}
//////////////////////////////////////
以上做法能分别将两段文字输出到richedit上,这两段文字是从数据库中读出的(两个字段)
如何将两段文字合起来,一起输出到richedit上???
我这样试,(不行)
....//从数据库中读strAAA, strBBB
strAAA += strBBB;EDITSTREAM es;
es.dwCookie = (DWORD)&strAAA; // Pass a pointer to the CString to the callback function
es.pfnCallback = MEditStreamInCallback; // Specify the pointer to the callback function
// Function defined in RichEg.cpp
m_richedit.StreamIn(SF_RTF, es);//在richedit上显示的还是AAA的内容
{
CString *psBuffer = (CString *)dwCookie; if (cb > psBuffer->GetLength()) cb = psBuffer->GetLength(); for (int i=0;i<cb;i++) {
*(pbBuff+i) = psBuffer->GetAt(i);
} *pcb = cb; *psBuffer = psBuffer->Mid(cb); return 0;
} {
CString strAAA, strBBB; //输出文字"..."RTF格式(AAA)
EDITSTREAM es;
es.dwCookie = (DWORD)&strAAA; // Pass a pointer to the CString to the callback function
es.pfnCallback = MEditStreamInCallback; // Specify the pointer to the callback function
// Function defined in RichEg.cpp
m_richedit.StreamIn(SF_RTF, es); //输出文字"..."RTF格式(BBB)
EDITSTREAM es;
es.dwCookie = (DWORD)&strBBB; // Pass a pointer to the CString to the callback function
es.pfnCallback = MEditStreamInCallback; // Specify the pointer to the callback function
// Function defined in RichEg.cpp m_richedit.StreamIn(SF_RTF, es);
}
//////////////////////////////////////
以上做法能分别将两段文字输出到richedit上,这两段文字是从数据库中读出的(两个字段)
如何将两段文字合起来,一起输出到richedit上???
我这样试,(不行)
....//从数据库中读strAAA, strBBB
strAAA += strBBB;EDITSTREAM es;
es.dwCookie = (DWORD)&strAAA; // Pass a pointer to the CString to the callback function
es.pfnCallback = MEditStreamInCallback; // Specify the pointer to the callback function
// Function defined in RichEg.cpp
m_richedit.StreamIn(SF_RTF, es);//在richedit上显示的还是AAA的内容
...//strAAA的内容
第二部分: //重新加的
...//strBBB的内容
strCCC = strAAA + strBBB;
这样应该可以的
和strAAA += strBBB;不是一样吗?
我的做法是:先StreamIn BBB,然后cut,StreamIn AAA, 后Paste
我的做法是:先StreamIn BBB,然后cut,StreamIn AAA, 后Paste