if (hFind == INVALID_HANDLE_VALUE) { TRACE ("Invalid File Handle. Get Last Error reports %d\n", GetLastError ()); return FALSE; } else { TRACE ("The first file found is %s\n", FindFileData.cFileName); while(FindNextFile(hFind,&FindFileData)) { TRACE ("The next file found is %s\n", FindFileData.cFileName); } } FindClose(hFind); return TRUE; } //调用示例: ShowFileList(_T("C:\\seu\\"), _T("*.*"));
#include <afxext.h>
改为多线程调试.
BOOL ShowFileList(CString strPath,CString strFileExt)
{ WIN32_FIND_DATA FindFileData;
HANDLE hFind;
hFind = FindFirstFile(strPath+strFileExt, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) {
TRACE ("Invalid File Handle. Get Last Error reports %d\n", GetLastError ());
return FALSE;
} else {
TRACE ("The first file found is %s\n", FindFileData.cFileName);
while(FindNextFile(hFind,&FindFileData))
{
TRACE ("The next file found is %s\n", FindFileData.cFileName);
}
}
FindClose(hFind);
return TRUE;
}
//调用示例: ShowFileList(_T("C:\\seu\\"), _T("*.*"));