Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can I hook the delete message?

Status
Not open for further replies.

WebStar

Programmer
May 1, 2002
69
DE
I wanna make a programm that doesn't allow an user to delete a file or a directory. I think that I should hook the delete system messasge and replace it or ban it! Anyone has an ideea?
 
System.IO.FileSystemWatcher class will allow you to catch a file delete event. Don't know how you will be able to catch a beforeDelete event. You could keep a backup copy somewhere and then copy a new version in if it gets deleted.

Whatever you do you will need a persistent process such as a Windows service to be running to monitor the events and react accordingly.

Aaron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top