我用CEvent.可是跳不出呀。
void Scan(LPTHREADPARAM lpTp)
{
CFileFind ff;
bool bOk;
CString strPath, strFile, strSearch;
CJunk j;
std::string s; if (!lpTp->m_strPath.GetLength()) { return; }
strSearch = lpTp->m_strPath;
CScanDisk::AdjustScanPath(&lpTp->m_strPath);

strSearch += _T("\\*.*");
bOk = ff.FindFile(strSearch);
if (!bOk) { return; } while (ff.FindNextFile())
{
strFile = ff.GetFileName();
if (strFile == _T(".") ||
strFile == _T(".."))
{
continue;
} if (::WaitForSingleObject(g_evt.m_hObject, 0) == WAIT_OBJECT_0) {
break;   // 跳出
}WAITSETSTRING:
if (::WaitForSingleObject(g_evt_set_string.m_hObject, 50) == WAIT_TIMEOUT)
{
goto WAITSETSTRING;
} if (ff.IsDirectory())
{
// Todo: is this dir will scan 
if (IsNotScan()((LPCTSTR)ff.GetFilePath())) { continue; }
lpTp->m_strPath = ff.GetFilePath();
Scan(lpTp);
}
//-------------------------------
// check if this is a junk file
//-------------------------------
strPath = ff.GetFilePath();
g_scan_path = strPath; // set current scan path;
g_evt_set_string.ResetEvent(); // besure each string main app could get
s = (LPCTSTR)strPath;
if (s == _T(""))
{
return;
} if (IsJunkFile()(s))
{
// strPath = ff.GetFilePath();
j.SetPath(strPath);
lpTp->m_pAr->Add(j);
}
} }