views:

147

answers:

1

1) How can I use FindFirstChangeNotification / FindNextChangeNotification + ReadDirectoryChanges to detect certain files being created or removed?

2) Is the FILE_NOTIFY_CHANGE_LAST_WRITE a reliable indicator of a file change?


Application: I have an explicit list of files that may be located in different folders. Display contents depends on the first file in the lsit that actually exists. For this, I want to add an auto-refresh mechanism.

Thus I need to detect "more important" files being created, the current file being changed or removed.

The list isn't long (maybe a dozen or so files), so I could poll the files, but for some applications the polling interval should be 50..80ms, ad I wonder if the monitoring API's are a better choice.

Response times should not exceed 200ms (not including any stalls due to unresponsive disks or high system load), but under ideal conditions, update should appear "immediate" to a human operator, without incurring high system load.

+3  A: 

The monitoring functions are a much better and cleanerr solution than polling, which itself would affect performance. But your response times cannot be guaranteed - Windows is not an RTS.

anon