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

📄 subject_14304.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:14304 发表者:polo 发表日期:2002-09-05 17:41:41
<br>主题:vc新手关于CFileFind类的急问
<br>内容:我要对一个目录下的所有.bmp图象进行处理,用了CFileFind::FindFile和CFileFind::FindNextFile,程序段落如下:<BR><BR>CFileFind m_find;<BR>if(m_find.FindFile("d:\\imagelib\\*.bmp",0)){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_find.FindNextFile();<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do {<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileName=m_find.GetFilePath();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.....<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>}<BR><BR>可是执行完之后,总发现该目录下有一个.bmp没被处理,本来觉得应该在执行完FindFile之后,GetFilePath,可查msdn,说的明明的要在GetFilePath之前必需执行至少一次FindFileNext。<BR><BR>哪位老兄老姐知道是咋回事呀??<BR><BR><BR><BR>
<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>回复者:Norton AntivVirus 回复日期:2002-09-06 12:39:07
<br>内容:CFileFind m_find;<BR>CString fileName;<BR>BOOL bl = m_find.FindFile("d:\\imagelib\\*.bmp",0);<BR>if(bl)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fileName = m_find.GetFilePath();<BR><BR>while(bl)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bl = m_find.FindNextFile();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(bl)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fileName = m_find.GetFilePath();<BR>........................<BR>}<BR><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>
回复者:Wang Tao 回复日期:2002-09-11 09:00:58
<br>内容:CFileFind m_find;<BR>if(m_find.FindFile("d:\\imagelib\\*.bmp",0)){<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do {<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileName=m_find.GetFilePath();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.....<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}while(m_find.FindNextFile());<BR><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 + -