I would set a breakpoint on the line
BeWorking = OneFile.FindFile (ocean);
And look at the value of your filter expression (
ocean
). I would assume the problem is there.
As a general remark: This code is a dump. Haven't you taken a look at it at all? For example, the loop
for(int j = 0; j<i;>
{
if (left[j] == '\\')
{
j++;
}
}
does not do anything at all. That might in fact be part of the problem, because in line
CString ocean = howlong + "*.*";
you simply append "*.*". What if howlong contained "c:\users\abc"? The filter would be "c:\users\abc*.*" and that might indeed only return a result of one file or even less.
The variable
gone
is set but never used. I would first clean this code up and then step through it with a debugger.