From: ReginaldoRigo on
I'm trying to write a routine just to copy all the text file from \\My
documents
and I've written something like this:

if RapiConnect(500) then
begin
GetMem( findData, sizeOf( findData ));
hResult := CeFindFirstFile('\My Documents\*.txt', findData);
while ( CeGetLastError <> ERROR_NO_MORE_FILES ) do
begin
{
do something with file
}
CeFindClose(hResult);
CeFindNextFile(hResult, findData);
end;
FreeMem( findData );
end;

I only get the first one.

What's wrong with the above code?

Any help will be very appreciated.

Thanks in an advance.


Reginaldo

From: Random on
On Feb 8, 2:58 pm, "ReginaldoRigo" <u58089(a)uwe> wrote:
> I'm trying to write a routine just to copy all the text file from \\My
> documents
> and I've written something like this:
>
>        CeFindClose(hResult);
>        CeFindNextFile(hResult, findData);

Don't close the handle the find results until your done with it after
your outermost loop. (And, I'd advise calling it something other than
hResult, that generally something that refers to an HRESULT, but
that's just a style suggestion).