Hi,
Is there a difference in getting the path of a file with GetOpenFileName or FindFirst and Findnext.
Because I have this problem. when I get the filename (and path) with FindFirst and Findnext, I have no probelems. But when I use the common dialogbox GetOpenFileName I get an Unhandled exception.
I can't find where he crashes by using breakpoints because I'm using threads (Actualy I don't see any problems why i shouldn't work, but it doesn't)
when I leave the threads (I start two of them) out, everything works well.
but when I try to find the error with breakpoints, he still gives the unhandled exeption before he stops at the first breakpoint.
It looks like the error happens between the _beginthread() and the calling of the thread function (strange )
here is some code:
Code:
/*this is in my main program
arglist is a structure I use for passing the parameters*/
arglist.kill=false;
strcpy(arglist.text,name);
_beginthread(FlashText,0,&arglist);//breakpoint
/*this is th thread function*/
void FlashText(PVOID pvoid)
{
ARGLIST *parglist;
parglist=(ARGLIST *)pvoid; //break point
char text[2000],buffer[40];
char display[40];
static char backup[2000];
int i,offset,len,j;
strcpy(text,parglist->text);
strcat(text," +++ ");
strcpy(backup,text);
len=strlen(text);
strncpy(display,text,33);
display[33]='\0';
offset=32;
j=0;
while(!parglist->kill)
{
SendDlgItemMessage(hmaindlg,IDC_INFO,WM_SETTEXT,0,(LPARAM)display);
for(i=0;i<31;i++)
buffer[i]=display[i+1];
buffer[31]=text[offset];
strcpy(display,buffer);
display[32]='\0';
if(offset==len-1)
offset=0;
else
offset++;
strcpy(text,backup);
Sleep(250);
}
}
//the error happens between the two breakpoints
variable name is a char[MAX_PATH]
When I copy the filepath that I got from Findfirst and findnext to name, everything works.
But when I do the same with GetOpenFileName, it doesn't anymore
please help me ::falls down on knees::