C language > Beginner questions
Monitoring File
(1/1)
Grincheux:
I would like to be notified when a file changes.
I explain:
I wrote an image viewer.
I select a file then launch the associated file to edit the image file.
I resize the image.
I save the image.
I quit the editor.
At the point I would like to know if the image has been modified.
I found FindFirstChangeNotification
and an example here
But is there an other method?
liut:
Try this way:
1. Use SHChangeNotifyRegister() to register a self-defined message
2. In main message loop, monitor this message; once the message delivers, use SHGetPathFromIDList() to analyse the shell file operations
3. Use SHChangeNotifyDeregister() to unregister the message when quitting
Please notice, if the system is very busy for a mass of file operations, not each file operation would be sent a message
Navigation
[0] Message Index
Go to full version