Forum > Windows

FindFirst loop

(1/2) > >>

jcmontherock:
Under Windows 11, I wrote an application to synchronize files from my laptop to the desktop computer. I am using a FindFirst loop to check last "update date" and "creation date" of each file contained in  a volume. I want to show, in a Memo, a message indicating the number of files already processed, after each 2000 files. For that I count the file entries processed and write my message. In fact some messages to memo are lost. I tried to use "Application.ProcessMessages" or "Sleep(0)" after sending my text, but nothing works. Messages are randomly shown in the Memo. I also have a progressbar and get the same problem with it. Is somebody has an idea how to solve that ?

Thaddy:
FindFirst should not loop. It is FindNext that may loop.

winni:
Hi!

Look at this example:

https://www.freepascal.org/docs-html/rtl/sysutils/findfirst.html

Winni

Zoran:
Here, on Windows 10, Memo works even without calling Application.ProcessMessages.
I don't have Win 11, but it is strange to me that it behaves differently, I believe it is more probable that you are doing something wrong.

Try the attached project. With Application.ProcessMessages, even ScrollBox with a label added to it for each line, gets regularly updated.

jcmontherock:
Thanks everybody. The Zoran's example works perfectly. So, finally I found that's a logical error was in my FindFirst, (with FindNext...::)) loop.

I do not find how to mark my question "solved". Nevertheless it is.

Navigation

[0] Message Index

[#] Next page

Go to full version