📄 subject_21491.htm
字号:
<p>
序号:21491 发表者:LoveMFC 发表日期:2002-11-18 10:26:25
<br>主题:如何使用CRcihEcitCtrl.StreamIn和StreamOut
<br>内容:我向大家请教如何使用CRcihEcitCtrl.StreamIn和StreamOut
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:芋头 回复日期:2002-11-18 10:39:24
<br>内容:MSDN里面有例子<BR>---------------------------------------------------<BR>StreamIn Example<BR><BR>// My callback procedure that writes the rich edit control contents<BR>// to a file.<BR>static DWORD CALLBACK <BR>MyStreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)<BR>{<BR> CFile* pFile = (CFile*) dwCookie;<BR><BR> *pcb = pFile->Read(pbBuff, cb);<BR><BR> return 0;<BR>}<BR><BR>// The example code.<BR> // The pointer to my rich edit control.<BR> extern CRichEditCtrl* pmyRichEditCtrl;<BR> // The file from which to load the contents of the rich edit control.<BR> CFile cFile(TEXT("myfile.rtf"), CFile::modeRead);<BR> EDITSTREAM es;<BR><BR> es.dwCookie = (DWORD) &cFile;<BR> es.pfnCallback = MyStreamInCallback; <BR> pmyRichEditCtrl->StreamIn(SF_RTF, es);<BR><BR>---------------------------------------------------<BR>StreamOut Example<BR><BR>// My callback procedure that reads the rich edit control contents<BR>// from a file.<BR>static DWORD CALLBACK <BR>MyStreamOutCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)<BR>{<BR> CFile* pFile = (CFile*) dwCookie;<BR><BR> pFile->Write(pbBuff, cb);<BR> *pcb = cb;<BR><BR> return 0;<BR>}<BR><BR>// The example code.<BR> // The pointer to my rich edit control.<BR> extern CRichEditCtrl* pmyRichEditCtrl;<BR> // The file to store the contents of the rich edit control.<BR> CFile cFile(TEXT("myfile.rtf"), CFile::modeCreate|CFile::modeWrite);<BR> EDITSTREAM es;<BR><BR> es.dwCookie = (DWORD) &cFile;<BR> es.pfnCallback = MyStreamOutCallback; <BR> pmyRichEditCtrl->StreamOut(SF_RTF, es);<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:LoveMFC 回复日期:2002-11-18 14:18:42
<br>内容:太谢谢了!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -