Now I write my own text editor, I wanna add a function that can keep watch on the change of the file after it's opened, if another program also open this file and modify it, furthermore save it, in this time, my program should notify user that another program has modified this file, and does he wanna reload it? can someone tell me how to realize this function?

dREAMtHEATER
Posted on 2002-05-08 07:44:39 by dREAMtHEATER
you can set timer for about 1 sec, and then U can use GetFileTime to check creation time, last access time, last write time and compare with yours times. or U can check file size and compare with Ur but the first method is better.

hope this will help
Posted on 2002-05-08 07:54:51 by NEMO
Hi! NEMO:
Thanks for your reply, I wanna know whether the first method is the most used method that other coder do, just like spying clipboard change, it have special API to do it, not use SetTimer API to spy, so I think spy file change maybe have special API to finished it.

dRAMtHEATER
Posted on 2002-05-08 08:09:28 by dREAMtHEATER
You can use the function FindFirstChangeNotification with a FILE_NOTIFY_CHANGE_LAST_WRITE || FILE_NOTIFY_CHANGE_SIZE filter. If you put this functionality into a thread, then you can even use the WaitForSingleObject call, then when the object becomes signalled you can do a callback to the main thread.
Posted on 2002-05-08 10:12:56 by sluggy
Hi! sluggy:
Thx a lot! This is just the key that I want, every Windows coder should write code with standard method, that is also the best way to learn programming.

dREAMtHEATER
Posted on 2002-05-08 10:55:50 by dREAMtHEATER
Hi everyone !
Is there a way to find the owner of a change handle notification ?
Posted on 2002-05-08 13:11:38 by Axial