Reputation: 40175
Should I look at shell notifications? Is there a good free component, or some example source code?
Or should I just start a one second timer and check the file's timestamp periodically?
It doesn't have to be elegant, just the simplest that will work. I am more interested in the processing which I will do when the file changes (it's a log file, whenever it gets updated I want to parse it and show some details of the test run).
Upvotes: 4
Views: 4362
Reputation: 16065
Jedi VCL inherits change-notification/folder-monitor from RxLib.
RxLib also might be available for older versions of Delphi
BTW, you did not specify you Delphi version. Please, press RETAG link and add the proper tag.
Upvotes: 3
Reputation: 116140
Shell notifications are nice, but more complex than a timer. If a one second polling interval is good enough, you could use that.
But you can build a 'Monitor' yourself, which encapsulates the actual monitoring code. This Monitor raises an event if the file is changed. That monitor of yours can encapsulate a timer at first (easy, two minute job), but can be modified to use shell notifications later (better), without having to modify all your application logic.
Upvotes: 4