|
-
Aug 18th, 2002, 01:09 PM
#1
Thread Starter
Hyperactive Member
files
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);
Matt 
-
Aug 18th, 2002, 04:04 PM
#2
Frenzied Member
Your loop never ends... try
Code:
while(FindNextFile(fhwnd,&fd) !=0) {
MessageBox(NULL,fd.cFileName,"2",MB_OK);
SendMessage(dbox,LB_ADDSTRING,0, (LPARAM)fd.cFileName);
}
-
Aug 20th, 2002, 02:26 PM
#3
Thread Starter
Hyperactive Member
Matt 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|