Delphi notification when a file gets updated
You can either:
use the Win32 API SHChangeNotifyRegister function to watch for changes in the temp folder, and then have your callback check if your temporary files are reporting changes.
since you know the exact file(s) you are interested in, you can manually monitor them directly for changes to their sizes and timestamps using FindFirstFile in a timer or thread.
In addition to what RRuz and Remy Lebeau wrote:
Note that TJvChangeNotify
in the JvChangeNotify
unit makes use of the FindFirstChangeNotification
API call; this is the MSDN documentation. Note it is a bit counter-intuitive: see the thread mentioned below on how to use it inside a while loop.
There is also the ReadDirectoryChanges
API call, which is not wrapped by the JCL/JVCL, and has MSDN documentation here and there is a Delphi win32 example as well.
This thread explains the differences between the two API calls.
--jeroen