| 发表于:2007-08-04 10:31:01 楼主 |
我用下面的函数搜索文件夹下的bmp文件,一般搜索是没问题的。 但是我在前面的窗口弹出选择文件对话框导入图片后,进入下个窗体,执行这个函数搜索文件夹这个函数就不起作用了,如果没有弹出导入图片对话框,直接进入下个窗体执行搜索就没问题。 handle handle = findfirstfile((lpcstr)cs,&data); 返回就为-1了!我想不明白,不导入图片用这个函数就没问题,只要弹出了导入对话框以后,就不行了,快郁闷死了,请帮忙解决一下1 bool emuarttemp(const char * path) { cstring ftype; cstring cs(path); win32_find_data data; cs += "\\*.* "; handle handle = findfirstfile((lpcstr)cs,&data); bool ret = (bool)handle; while(ret) { if(data.dwfileattributes & file_attribute_directory) { if(data.cfilename[0] != '. ') { // cs = path; // cs += "\\ "; // cs += data.cfilename; // emufiles((lpcstr)cs); //递归遍历子文件夹 } } else //is a file { cs = path; cs += data.cfilename; ftype = cs.right(3); if( ftype== "bmp " ¦ ¦ ftype== "bmp " ¦ ¦ ftype== "bmp " ¦ ¦ ftype== "bmp " ¦ ¦ ftype== "bmp " ¦ ¦ ftype== "bmp " ¦ ¦ ftype== "bmp " ¦ ¦ ftype== "bmp ") { arttemplist.push_back(cs); } } ret = findnextfile(handle,&data); } findclose(handle); return true ; } |
|
|
|
|