I have one question.
what are "." and ".." directory? what are they doing? why are they searched? I don't have . and .. directory in that folder which I wanted to search. I wonder. tell me please ... here, it's the findfile code.
GetWindowsDirectory(Path,MAX_PATH);
lstrcat(Path,"\\*.*");
hSrch=FindFirstFile(Path,&wfd);
if (hSrch==INVALID_HANDLE_VALUE) return;
while (bResult) {
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
wsprintf(fname,"[ %s ]",wfd.cFileName);
} else {
wsprintf(fname,"%s",wfd.cFileName);
}
SendMessage(hList,LB_ADDSTRING,0,(LPARAM)fname);
bResult=FindNextFile(hSrch,&wfd);
}
FindClose(hSrch);
.
) and parent dir (..
) unless you're at the root dir. Always filter them out from your directory scan.