MFC版本(MSDN)
void CXXXXView::Recurse(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)
{
//You must call FindNextFile at least once before calling any of the following attribute member functions:
//Isxxx or Getxxx
bWorking = finder.FindNextFile();
// skip . and .. files; otherwise, we'd
// recur infinitely!
// [IsDots]
// Nonzero if the found file has the name "." or "..", which indicates
// that the found file is actually a directory. Otherwise 0.
if (finder.IsDots())
continue;
// if it's a directory, recursively search it
if (finder.IsDirectory())
{
CString str = finder.GetFilePath();
TRACE(_T("%s\n"), (LPCTSTR)str);