this code keeps on returning the last file over and over and I can't figure out how to make it stop on "no more files"
Code:int temp; char wtxt[25]; HANDLE fhwnd; BOOL fhwnd2; WIN32_FIND_DATA fd; temp = GetWindowText(dir, wtxt,25); MessageBox(NULL,wtxt,"hello",MB_OK); fhwnd = FindFirstFile(wtxt,&fd); if(fhwnd == INVALID_HANDLE_VALUE){ return 0; }else //MessageBox(NULL,fd.cFileName,"1",MB_OK); SendMessage(dbox,LB_ADDSTRING,0, (LPARAM)fd.cFileName); while(fhwnd!=0) { fhwnd2 = FindNextFile(fhwnd,&fd); MessageBox(NULL,fd.cFileName,"2",MB_OK); SendMessage(dbox,LB_ADDSTRING,0, (LPARAM)fd.cFileName); } FindClose(fhwnd);





Reply With Quote