I've created a new class called CFileChangeEvent. This class has following methodes :
void addFile(const std::string &sFileName)
Use this method when you want to be notified of changes of a file. When the notification thread is running it will be stopped and restarted.
void removeFile(const std::string &sFileName)
Use this method when you don't want to be notified anymore. When the notification thread is running it will be stopped and restarted.
This method starts the notification thread.
This method stops the notification thread. It's also called in the destructor, so you the thread will allways stop.
virtual void OnFileAlarm(FileAlarm nAlarm, const std::string &sFileName)
Override this method. This method is called when a file is changed or deleted. FileAlarm is an enum with following attributes : FA_CHANGED, FA_REMOVED.
How to use this class ?
Derive a class (for example your CDocument-class) from CFileChangeEvent and override the OnFileAlarm. That's all.
Date Last Updated: May 17, 1999