DelphiFAQ Home Search:

Detecting File Accesses

 

comments2 comments. Current rating: 5 stars (1 votes). Leave comments and/ or rate it.

Question:

In a program that I'm writing, I need to know when any file is opened or saved and what the name of that file is. Is there an easy way to make a hook procedure with the Windows API or messages?

Answer:

Yes, the Windows operating system does offer such a hook, at least in Windows NT 4.0 and in Windows 2000. The following should also work with Windows 98/ ME.

You could dig through the Windows API files, but luckily there is also an easier way to accomplish this task – use the excellent free component library RxLib. It contains a component that does exactly the desired function.The name of this component is TRxFolderMonitor.
I have used this TRxFolderMonitor component in one network application and it worked really great - no need to dig in the source.

You simply put a TRxFolderMonitor component on your form and assign the Directory property the directory which you need to monitor. You can even tell the component to monitor subdirectories (recursively)!

TRxFolderMonitor will create a thread for you that gets activated in the even of a detected change.

Comments:

2006-08-25, 14:15:09
anonymous from India  
Is it possible to call TRxFolderMonitor component from .net
2006-09-13, 02:35:56
anonymous from Vietnam  
rating

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Washington, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.