监视文件打开c#.Net [英] Monitor file open c# .Net

查看:129
本文介绍了监视文件打开c#.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



使用FileSystemWatcher,有一个应用程序需要监视文件的打开,但是我没有找到任何方法可以做到这一点。没有选择可以监视文件的打开。只是创建,删除和修改的。



所以我想知道在高级搜索中是否有任何功能可以给我提供在一个具体的日期。 (至少在Mac中是可能的,但我不确定Windows是否实现了这个功能)

其他解决方案是开发一个文件系统过滤驱动程序,但是我发现这种方式太难了

解决方案

我不能给你一个直接的答案(因为我不知道),但自从微软发布FileMon工具,你在做什么后,似乎Windows确实有办法通知文件打开,关闭和访问。这在这里讨论当一个本地文件在Windows中访问,但这只能覆盖文件的更改,而不能打开和关闭。有一种方法可以获得由此处讨论的过程打开的所有文件 Delphi - 获取应用程序打开的文件,这可能是FileMon正在使用的文件,但有一些警告(即其内部的OS API)。

希望这有帮助,对不起,不能直接给出答案。

I want to build an app that needs to monitor the opening of the files but I don't find any way to can do it.

With FileSystemWatcher there is no option to can monitor the opening of the files. Just the created, removed and modified ones.

So I wonder if there is any functionality implemented in the advanced searches that could give me the infomration of the files opened after a concrete date. (At least in Mac it's possible but I am not sure if Windows has implemented this)

Other solution would be to develop a File System Filter Driver, but I find this way too hard

解决方案

I cant give you a direct answer (because I dont know) but since Microsoft publish the FileMon tool which does exactly what you are after, it seems that Windows does have a way of notifying file open, close and access. This is discussed here Getting a notification when a local file is accessed in windows but this only covers the change of files, not opening and closing. There is a way of getting all the files opened by a process discussed here Delphi - get what files are opened by an application which is possibly what FileMon is using, but there are caveats (i.e. its an internal OS API).

Hope this helps, sorry cannot give a direct answer.

这篇关于监视文件打开c#.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆