-
文件修改监控
ReadDirectoryChangesW 有同步和异步2种方式,
根据前面打开的文件夹对象句柄决定。
1. 异步方式,如果 CreateFile 指定了打开类型 FILE_FLAG_OVERLAPPED 就是异步方式,ReadDirectoryChangesW 调用的时候就需要指定 OVERLAPPED 参数.
接下来对文件夹I/O变化的响应判断有多种方式。
A通过不断的调用HasOverlappedIoCompleted函数(非阻塞,参数就是前面的OVERLAPPED 对象指针)的返回值来判断是否发生了 关注文件句柄的I/O操作。如果发生变化,再执行你的 switch(Buffer[0].Action) 操作过程。
B GetOverlappedResult 读取 OVERLAPPED 对象的结果。(阻塞)
C 完成端口 GetQueuedCompletionStatus (阻塞)。
其中阻塞方式,必须采用多线程的方式,否则你的主线程被阻塞的话,对话框就动不了了。非阻塞方式也可用多线程,结合hEvent对象来使用。
2.同步方式,如果CreateFile不指定FILE_FLAG_OVERLAPPED ,就是同步方式。
同步方式操作比较简单。lz的程序看来就是使用的同步方式。
在同步下,ReadDirectoryChangesW 将被阻塞,直到一个文件夹句柄的I/O操作到来,然后才能判断。所以lz的程序会死掉。
同步方式必须采用多线程,再创建一个线程,线程函数采用如下方式:
UINT ThreadProc(PVOID)
{
CreateFile();
while(1) // 如果只想监视一次文件的I/O变化,可不用while循环。
{
- 2022-03-10 05:44:52下载
- 积分:1
-
A simple calculator that supports basic arithmetic, prime number checking, trigo...
A simple calculator that supports basic arithmetic, prime number checking, trigonometry, quadratic equation solving, and as of version 1.4, graphing. The calculator includes installation instructions and extensive help.
- 2022-02-02 20:19:11下载
- 积分:1
-
利用这个源代码我们可以更深的了解关于netstat这个命令是如何工作的,这个源代码可以扫描指定网段内的主机的用户信息...
利用这个源代码我们可以更深的了解关于netstat这个命令是如何工作的,这个源代码可以扫描指定网段内的主机的用户信息-we can understand much deepper about the mechanism of NETSTAT command , this source code can scan the information of PCs in certain ip range
- 2022-04-22 17:03:33下载
- 积分:1
-
不怕益出的SPRINTF只不过功能不及SPRINTF那么的完善罢了我已试国了基本无问题...
不怕益出的SPRINTF只不过功能不及SPRINTF那么的完善罢了我已试国了基本无问题-Benefits are not afraid of the sprintf function as sprintf only so much I have try to improve the country without the basic problem
- 2022-09-08 03:15:02下载
- 积分:1
-
一个不错的屏幕键盘操作程序,决不亚于windows自带的虚拟键盘程序吆!...
一个不错的屏幕键盘操作程序,决不亚于windows自带的虚拟键盘程序吆!- A good screen keyboard operation sequence, is inferior to the
hypothesized keyboard procedure which windows brings to shout in no
way!
- 2023-09-04 06:55:03下载
- 积分:1
-
采用TCP handoff技术实现服务器集群。减少接入点的负载负担,使得集群的性能大大提高。...
采用TCP handoff技术实现服务器集群。减少接入点的负载负担,使得集群的性能大大提高。-Using TCP handoff technology for server clusters. The burden of reducing the load on the access point, making the performance of the cluster increased substantially.
- 2022-07-07 23:10:52下载
- 积分:1
-
读取.Frx中的图片.rar
读取.Frx中的图片.rar-read. Frx the picture. Rar
- 2022-01-27 19:43:04下载
- 积分:1
-
源码,挺有用的。
不过里面是用txt写的,自己在vc里运行一下吧。...
源码,挺有用的。
不过里面是用txt写的,自己在vc里运行一下吧。-Source, quite useless. But there is a txt written to run in vc you.
- 2022-12-10 14:20:03下载
- 积分:1
-
本文档包含有关原理matlab的细节。关于各种文件…
This document contains details about fundamentals of matlab. about various file types,outputs,windows in matlab software,displaying images and sample codes and outputs.
- 2022-05-07 23:59:13下载
- 积分:1
-
实现了编译算法的词法分析,不足之处请多多指教
实现了编译算法的词法分析,不足之处请多多指教-Achieved a compiler algorithm for lexical analysis of the inadequacies of the exhibitions please
- 2022-07-23 09:23:00下载
- 积分:1