NO

Author Topic: Monitoring File  (Read 2834 times)

Grincheux

  • Guest
Monitoring File
« on: April 12, 2017, 12:03:53 PM »
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

  • Guest
Re: Monitoring File
« Reply #1 on: May 10, 2017, 08:55:40 AM »
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