FindFirst loop lazarus / 67-Windows ---------------------------------------------------------------------- jcmontherock · 2022-03-26 10:47 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 · 2022-03-26 10:56 FindFirst should not loop. It is FindNext that may loop. ---------------------------------------------------------------------- winni · 2022-03-26 11:35 Hi! Look at this example: https://www.freepascal.org/docs-html/rtl/sysutils/findfirst.html Winni ---------------------------------------------------------------------- Zoran · 2022-03-26 13:05 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 · 2022-03-27 09:48 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. ---------------------------------------------------------------------- Bart · 2022-03-27 10:28 Quote from: jcmontherock on March 27, 2022, 11:48:31 amI do not find how to mark my question "solved". Nevertheless it is. Edit your first post and then add [Solved] to the subject line. Bart