Ja do szukania w odtwarzaczu plików muzycznych używam tego kodu. Musisz tylko zmienić początek:
void fDrop_Read(const char *sDir, HWND *hwnd){
WIN32_FIND_DATA fdFile;
HANDLE hFind = NULL;
char sPath[2048];
sprintf(sPath, "%s\\*.*", sDir);
if((hFind = FindFirstFile(sPath, &fdFile)) == INVALID_HANDLE_VALUE)
return;
do
{
if(strcmp(fdFile.cFileName, ".") != 0
&& strcmp(fdFile.cFileName, "..") != 0)
{
sprintf(sPath, "%s\\%s", sDir, fdFile.cFileName);
if(fdFile.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY)
{
fDrop_Read(sPath, hwnd);
}
else{
/// Jest PLIKIEM
if(fDrop_SprawdzRozszerzenie(sPath))
{
if(hwnd == NULL)
fList_DodajElement(sPath, NULL);
else
fList_DodajElement(sPath, hwnd);
}
}
}
}
while(FindNextFile(hFind, &fdFile)); //Find the next file.
FindClose(hFind); //Always, Always, clean things up!
}
void fDrop_ReadFirst(WPARAM wParam, HWND *hwnd){
hDrop = (HDROP)wParam;
char sItem[MAX_PATH];
for(int i = 0; DragQueryFile(hDrop, i, (LPSTR)sItem, sizeof(sItem)); i++)
{
if(GetFileAttributes(sItem) &FILE_ATTRIBUTE_DIRECTORY)
{
/// Jest KATALOGIEM
if(hwnd == NULL)
fDrop_Read(sItem, NULL);
else
fDrop_Read(sItem, hwnd);
}
else
{
/// Jest PLIKIEM
if(fDrop_SprawdzRozszerzenie(sItem))
{
if(hwnd == NULL)
fList_DodajElement(sItem, NULL);
else
fList_DodajElement(sItem, hwnd);
}
}
}
DragFinish(hDrop);
fList_OdswiezScrollBar();
}