⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_21491.htm

📁 一些关于vc的问答
💻 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>&nbsp;&nbsp; CFile* pFile = (CFile*) dwCookie;<BR><BR>&nbsp;&nbsp; *pcb = pFile-&gt;Read(pbBuff, cb);<BR><BR>&nbsp;&nbsp; return 0;<BR>}<BR><BR>// The example code.<BR>&nbsp;&nbsp; // The pointer to my rich edit control.<BR>&nbsp;&nbsp; extern CRichEditCtrl* pmyRichEditCtrl;<BR>&nbsp;&nbsp; // The file from which to load the contents of the rich edit control.<BR>&nbsp;&nbsp; CFile cFile(TEXT("myfile.rtf"), CFile::modeRead);<BR>&nbsp;&nbsp; EDITSTREAM es;<BR><BR>&nbsp;&nbsp; es.dwCookie = (DWORD) &amp;cFile;<BR>&nbsp;&nbsp; es.pfnCallback = MyStreamInCallback; <BR>&nbsp;&nbsp; pmyRichEditCtrl-&gt;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>&nbsp;&nbsp; CFile* pFile = (CFile*) dwCookie;<BR><BR>&nbsp;&nbsp; pFile-&gt;Write(pbBuff, cb);<BR>&nbsp;&nbsp; *pcb = cb;<BR><BR>&nbsp;&nbsp; return 0;<BR>}<BR><BR>// The example code.<BR>&nbsp;&nbsp; // The pointer to my rich edit control.<BR>&nbsp;&nbsp; extern CRichEditCtrl* pmyRichEditCtrl;<BR>&nbsp;&nbsp; // The file to store the contents of the rich edit control.<BR>&nbsp;&nbsp; CFile cFile(TEXT("myfile.rtf"), CFile::modeCreate|CFile::modeWrite);<BR>&nbsp;&nbsp; EDITSTREAM es;<BR><BR>&nbsp;&nbsp; es.dwCookie = (DWORD) &amp;cFile;<BR>&nbsp;&nbsp; es.pfnCallback = MyStreamOutCallback; <BR>&nbsp;&nbsp; pmyRichEditCtrl-&gt;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 + -