void CSearchFileDlg::SearchFile(CString strStartFolder)
{
CString strTmp, strName;
CFileFind cfile;
BOOL b;
MSG msg;
if(strStartFolder.Right(1) == "\\")
strTmp = strStartFolder + "*.*";
else
{
strTmp = strStartFolder + "\\";
strTmp += "*.*";
}
b = cfile.FindFile(strTmp);
while(b)
{
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if(m_bStop)
return;
b = cfile.FindNextFile();
if(cfile.IsDots())
continue;
strName = cfile.GetFileName();
if(cfile.IsDirectory())
{
if(strName.Find(m_strFileName) != -1)
{
...
}
SearchFile(cfile.GetFilePath());
}
else
{
if(strName.Find(m_strFileName) != -1)
{
...
}
}
}
}
void CSearchFileDlg::OnButtonStop()
{
// TODO: Add your control notification handler code here
m_bStop = TRUE;
}