http://www.codeproject.com/cs/files/C__FileWatcher.asp
It may help you out.
Cheers,
Balaji Prabu
Thanks for the reply, but that's not what I need. This page tells me to monitor a folder for change then do something . No, what I want is when windows have a copy or move request it comes to me first then i decide whether this operation occurs or not according to the destination to protect files from being copied from the computer. My search led to an
interface called ICopyHook which is an API method I can't use !!
The link is http://msdn2.microsoft.com/en-us/library/ms646538.aspx.ICopyCallback is only used when the shell copies a file or an application uses SHFileOperation to copy the file. A command prompt or a .NET application using File.Copy won't use SHFileOperation.
Short of writing some sort of file system shim or a system hook (both of which can't be done with .NET), you can't intercept a file operation like copying.