是否有 ICopyHook.CopyCallback 文件或替代方案?
我们使用 ICopyHook.CopyCallback shell 扩展来检测 文件夹 的删除、移动和创建,但不检测文件 链接,如何检测用户是否从 C# 应用程序中删除文件,或者如何处理用户的删除操作? 示例:用户在 f1.txt 上按 Shift + DEL,然后操作系统询问“Are Yuo Sure You Want to delete 'f1.txt'?”,如果用户按 'yes',则 C# 应用程序将通过以下方式处理删除操作:以透明方式将“f1.txt”移动到某个隐藏文件夹{例如}???
注意:我认为 FileSystemWatcher 无法执行此任务..
we use ICopyHook.CopyCallback shell extension to detect deletion , moving ,creation of folders , but not files Link , How to detect if the user is deleting a file from C# Application , or How to handle the delete operation for the user ?
example : the user press Shift + DEL on f1.txt, then the operating System asks "Are Yuo sure You Want to delete 'f1.txt'? , if the user press 'yes' then the C# application will handle the deletion operation by moving 'f1.txt' to some hidden folder {for example } in transparent way ???
note : I think FileSystemWatcher can NOT do this task ..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要一个文件系统过滤驱动程序,它将拦截文件删除或文件移动(文件被移动到回收站)的请求并采取相应的行动。
请注意,由于在文件系统级别上不存在复制文件之类的操作(ICopyHook 只能捕获由 Explorer 本身或通过 shell API 函数进行的操作),因此您将无法使用文件系统过滤器驱动程序跟踪“复制”(或通过任何其他方式)。
You need a file system filter driver, which will intercept requests for file deletion or file moving (the file is moved to recycle bin) and will act accordingly.
Note, that as there's no such operation as copying a file on file system level (ICopyHook can catch only operations carried by Explorer itself or via shell API functions), you won't be able to track "copying" using file system filter driver (or by any other means).