Author Topic: Monitoring File  (Read 405 times)


  • 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?

Offline liut

  • Member
  • *
  • Posts: 45
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