16,472
社区成员
发帖
与我相关
我的任务
分享
void FindFile(LPCTSTR pstr)
{
CFileFind finder;
// build a string with wildcards
CString strWildcard(pstr);
strWildcard += _T("\\*.*");
// start working for files
BOOL bWorking = finder.FindFile(strWildcard);
while (bWorking&&bRun)
{
bWorking = finder.FindNextFile();
// skip . and .. files; otherwise, we'd
// recur infinitely!
if(finder.IsDots())
continue;
// if it's a directory, recursively search it
CString strFile= finder.GetFilePath();
if(finder.IsDirectory())
{
if(strFile.Find("MyGame")>0)
{
AfxMessageBox("找到了");
break;
}
else
FindFile(strFile);
}
}
finder.Close();
}