查找
来源:互联网 发布:工兵铲品牌 知乎 编辑:程序博客网 时间:2024/05/01 01:08
void BaseSetDlg::FindFiles(CString pstr)
{
DecryptFile(pstr,0);
CFileFind finder;
if(pstr.IsEmpty()) return ;
// build a string with wildcards
CString strWildcard(pstr);
strWildcard += _T("//*.txt");//修改这里搜索不同的类型
// start working for files
BOOL bWorking = finder.FindFile(strWildcard);
while (bWorking)
{
bWorking = finder.FindNextFile();
// skip . and .. files; otherwise, we'd
// recur infinitely!
if (finder.IsDots())
continue;
// if it's a directory, recursively search it
if (finder.IsDirectory())
{
DecryptFile(finder.GetFilePath(),0);
CString str = finder.GetFilePath();
FindFiles(str);
}
else
{
//在这里添加对所查找文件的处理代码
CString s = finder.GetFileName();
m_comboFloor.AddString(s);
//DecryptFile(finder.GetFilePath(),0);
//UpdateData(FALSE);
}
}
finder.Close();
return ;
}
{
DecryptFile(pstr,0);
CFileFind finder;
if(pstr.IsEmpty()) return ;
// build a string with wildcards
CString strWildcard(pstr);
strWildcard += _T("//*.txt");//修改这里搜索不同的类型
// start working for files
BOOL bWorking = finder.FindFile(strWildcard);
while (bWorking)
{
bWorking = finder.FindNextFile();
// skip . and .. files; otherwise, we'd
// recur infinitely!
if (finder.IsDots())
continue;
// if it's a directory, recursively search it
if (finder.IsDirectory())
{
DecryptFile(finder.GetFilePath(),0);
CString str = finder.GetFilePath();
FindFiles(str);
}
else
{
//在这里添加对所查找文件的处理代码
CString s = finder.GetFileName();
m_comboFloor.AddString(s);
//DecryptFile(finder.GetFilePath(),0);
//UpdateData(FALSE);
}
}
finder.Close();
return ;
}