From: Tina on
On Nov 11, 12:02 pm, Tina <mstin...(a)gmail.com> wrote:
> I noticed that when I call the FindFirstFile or FindNextFile on a
> large folder of tens of thousands of files, it can take several
> minutes at Windows start up time before the function even returns. My
> question is whether there exists an API I can use to cancel the find?
> I'd like to use this API to possibly cancel the search immediately (or
> close to immediately) from a different thread that will check on
> whether or not the Find has been completed.

I am actually having the same problem as this person:
http://forum.sysinternals.com/forum_posts.asp?TID=14448, but he is
asking why it is so slow and how to speed it up. I am, however,
accepting the fact the first time you run it, it is slow, but I want
the option to cancel that operation mid process.
From: Seetharam on
http://msdn.microsoft.com/en-us/library/aa480216.aspx#win32iocancellationapisv2_topic10
clearly says that on XP, cancellation of IO doesn't work and MS has
done improvements vista onwards.

I think your best bet is to move the FindFirstFile()/FindNextFile()
calls into a worker thread and try cancel the thread when you don't
want to proceed any further with the file IO. Thay way your main
thread is not affected.

You coudl also post this question in the microsoft.public.vc.mfc
group. There are some very knowledgeable people monitoring those
groups.

-Seetharam



From: Ron Francis on
"Seetharam" <smisro(a)gmail.com> wrote in message
news:f1967f71-32a9-4141-87d0-4202caec723c(a)p19g2000vbq.googlegroups.com...
> http://msdn.microsoft.com/en-us/library/aa480216.aspx#win32iocancellationapisv2_topic10
> clearly says that on XP, cancellation of IO doesn't work and MS has
> done improvements vista onwards.
>
> I think your best bet is to move the FindFirstFile()/FindNextFile()
> calls into a worker thread and try cancel the thread when you don't
> want to proceed any further with the file IO. Thay way your main
> thread is not affected.
>
> -Seetharam

That is exactly what I was going to suggest.

--
Regards
Ron Francis
www.RonaldFrancis.com