电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

vc打开文件夹VIP专享VIP免费

vc打开文件夹_第1页
vc打开文件夹_第2页
vc打开文件夹_第3页
1: CString strDir;//储存文件夹路径 CFileFind ff; ......... /* 获取文件夹路径*/ strDir+="*.*";//如果是只需要某种文件,怎么替换应该很简单了吧 BOOL res =ff.FindFile(strDir); while(res) { res=ff.FindNextFile(); if(ff.IsDirectory){/*如果是文件夹就XXXXX*/}; else { //ff.GetFileName 就是每个文件名,比如如下设计 CString s; s.Format("%s",ff.GetFileName()); ///干你想干的事情吧 ///不过注意有时候会把你看不到得系统文件也读出来 } } 2: VC 代码,功能很完整。可以只选择文件夹中的一幅图像,然后点 OK,会自动遍历 整个文件夹。读取各个文件的完整路径到一个vector 中,并不把所有图像读进内存,这样可以 节省不必要的内存开销。 在处理函数中,根据这些完整的路径,打开一个处理一个释放一个。 直到处理完所有图像。 C/C++ code int CBatch::FileOpenEx() { int counter = 0 ; CString ss = "" ; pair < map < CString,CString > ::iterator, bool > Pair_Insert; // TODO: Add your command handler code here int nimg = 0 ; CString ftitle,fname,fpath,fpathname,froot; CString mp[ 7 ]; static char szFilter[] = " *.BMP|*.BMP|All Files(*.*)|*.*|| " ; CFileDialog FileDlg( TRUE, NULL, NULL,OFN_HIDEREADONLY, szFilter ); if ( FileDlg.DoModal() == IDOK ) { fpathname = FileDlg.GetPathName(); CFileFind finder; finder.FindFile(fpathname); finder.FindNextFile(); froot = finder.GetRoot(); BOOL bResult; fpathname = froot + _T( " \\*.* " ); // 找到该文件的文件夹, bResult = finder.FindFile(fpathname); // 然后从头开始一个一个遍历 while (bResult) { counter ++ ; bResu lt = finder.FindNex tFile(); if (finder.IsDots()) continu e ; if (finder.IsDirectory ()) continu e ; fname = finder.GetFileName(); if ( " bmp " != fname.Right( 3 ) && " BMP " != fname.Right( 3 ) ) continu e ; // 找到了一个bmp 文件,开始提取相关信息 FPRO fpro; // 自定义的一个结构体 fpro.filePath = finder.GetFilePath(); // 路径和文件名,包括扩展名。 fpro.fileName = finder.GetFileName()...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部