experiment: File Change Notification
来源:互联网 发布:广州新百佳网络批发 编辑:程序博客网 时间:2024/05/16 08:35
search keywords "ReadDirectoryChangesW", find some demo.
好理解的demo:
<<Spying a file system>> : http://www.codeproject.com/KB/files/FileSpyArticle.aspx
没有使用overlapped, 有少许的内存泄漏.
tips:
FindFirstChangeNotification, FindNextChangeNotification and FindCloseChangeNotification, 只能侦测到目录是否有文件改变的通知, 无法具体到某个文件. 如果需要知道哪个文件被改变了,需要自己去遍历, 效率相当的低.
CreateFile, ReadDirectoryChangesW, CloseHandle, 可以将文件通知具体到每个文件. 效率高.
因为没有使用overlapped, 导致被监测的文件不能重命名.
不好理解的demo:
<<CDirectoryChangeWatcher - ReadDirectoryChangesW all wrapped up>>http://www.codeproject.com/KB/files/directorychangewatcher.aspx
使用了overlapped, 可以对文件进行改名. 符合实际应用.
按照directorychangewatcher整理出一个不需要窗口句柄的Demo, 发现如果操作大量的文件, 文件通知的不全.
如果操作单个文件, 效果很好.
<2011_0919>
早上遇到同事,讨论了这个问题。他以前做过这个问题的预言, 也发现如果一次操作的文件多了,是会有遗漏的文件通知发生。真正要解决这个问题,是在驱动层去做这事才靠谱.
- experiment: File Change Notification
- 关于File Change Notification (FCNs)
- fschange – Linux File System Change Notification
- experiment : change main program entry
- File Change
- Database Change Notification
- Database Change Notification
- oracle data change notification机制
- experiment: save and restore file time
- experiment
- Experiment
- experiment
- Change File Attributes
- batch change file name
- Change file permissions
- touch - change file timestamps
- 深入详解Oracle data change notification
- experiment:Finding crash information using the MAP file on vs2005
- java集合类中常见接口、类的区别和联系
- tar命令使用
- C# 扩展方法简介
- SQL---DML---联结表のCROSS JOIN和INNER JOIN
- java的存储
- experiment: File Change Notification
- PHP学习笔记
- Android培训班(71)Dex文件里类定义dvmDefineClass
- 将对象强制转换成任意类型
- Bubble Sort 冒泡排序
- WPF架构关键技术剖析(1)--序言
- HDU 3683
- 字符串定义:s[]和*s 的区别
- 程序在内存中的分布