2: {
3:
4: // 파일 탐색 필터 정의 - Ini에서 확인 - 변경할 것
5: CString strMusicFilter = ".MP3.OGG.WMA.WAV";
6: CString strMovieFilter = ".AVI.WMV.MKV.MPEG.MPG";
7: CString strImageFilter = ".JPEG.JPG.BMP.PNG.GIF";
8: CString strDocumentFilter = ".TXT";
9:
10: CFileFind file;
11: BOOL b = file.FindFile(strFolder + "\\*.*");
12: CString strFolderItem, strFileExt, strTempString;
13:
14: CString strTempPath;
15: strTempPath = GetSpecialFolderPath(CSIDL_HISTORY);
16: strTempPath = strTempPath.Left(strTempPath.ReverseFind('\\')) + "\\Temp";
17:
18: while(b)
19: {
20: b = file.FindNextFile();
21:
22: if(file.IsDirectory() && !file.IsDots())
23: {
24:
25: strFolderItem = file.GetFilePath();
26:
27: // 사용하지 않는 시스템 폴더들은 탐색에서 제외한다
28: if (
29: strFolderItem.Find(GetSpecialFolderPath(CSIDL_WINDOWS)) > -1 ||
30: strFolderItem.Find(GetSpecialFolderPath(CSIDL_INTERNET_CACHE)) > -1 ||
31: strFolderItem.Find(GetSpecialFolderPath(CSIDL_HISTORY)) > -1 ||
32: strFolderItem.Find(GetSpecialFolderPath(CSIDL_COOKIES)) > -1 ||
33:
34: strFolderItem.Find(GetSpecialFolderPath(CSIDL_COMMON_APPDATA)) > -1 ||
35: strFolderItem.Find(GetSpecialFolderPath(CSIDL_APPDATA)) > -1 ||
36: strFolderItem.Find(GetSpecialFolderPath(CSIDL_LOCAL_APPDATA)) > -1 ||
37:
38: strFolderItem.Find(GetSpecialFolderPath(CSIDL_PROGRAM_FILES)) > -1 ||
39:
40: strFolderItem.Find(strTempPath) > -1 )
41: {
42:
43: TRACE("제외 : %s\n", strFolderItem);
44: continue;
45: }
46:
47: //하위폴더를 검색하는 조건이면 재귀호출 발생
48: if (m_bSearchSubFolder)
49: GetFileList(strFolderItem);
50: }
51:
52: strFolderItem = file.GetFilePath();
53: strFileExt = strFolderItem.Mid(strFolderItem.ReverseFind('.'));
54: strFileExt.MakeUpper();
55:
56: // 파일 탐색 필터 정의에따라 해당 StringList에 추가
57: if (strMusicFilter.Find( strFileExt , 0) > -1 && !file.IsDots())
58: {
59: m_strlistMusic.AddTail(strFolderItem);
60: }
61: else if (strMovieFilter.Find( strFileExt , 0) > -1 && !file.IsDots())
62: {
63: m_strlistMovie.AddTail(strFolderItem);
64: }
65: else if (strImageFilter.Find( strFileExt , 0) > -1 && !file.IsDots())
66: {
67: m_strlistImage.AddTail(strFolderItem);
68: }
69: else if (strDocumentFilter.Find( strFileExt , 0) > -1 && !file.IsDots())
70: {
71: m_strlistDocument.AddTail(strFolderItem);
72: }
73: }
74: }