-
文件修改监控
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
-
本人使用WIN2000,一直以为开着系统服务 Windows Time 就能自动实现系统对时。 哪知道前两天一对时,发现快了1分钟,天,我上下班打卡可是直接与经...
本人使用WIN2000,一直以为开着系统服务 Windows Time 就能自动实现系统对时。 哪知道前两天一对时,发现快了1分钟,天,我上下班打卡可是直接与经济利益挂钩的。真不知道这玩意是不是仅用来浪费系统资源的。 一气之下,自己花点时间写了个对时程序,嗯,不错,挺好用,这下安心了,另外,那个对时的垃圾服务也可以关掉了。-Oneself usage WIN2000, has been thinking to open the system service Windows Time and then can realizes automatically system to hour. Which know a rightness of the first two days, discover quick a minute, day, I top and bottom the class beats the card but direct and economic benefits hook of.Really do not know that does this trifle is only use to the wasted system resources of. In a pet, oneself the flower orders time wrote a garbage for to timing preface, H m, quite goodly, quite goodly using, this bottom having peace of mind, moreover, that to hour service and can also turn o
- 2022-03-26 15:25:57下载
- 积分:1
-
Forcal是一个对字符表达式进行编译计算的动态链接库,具有数值计算、关系运算、逻辑运算、字符处理、流程控制、函数调用等许多的可编程功能。它的部分开发文档是由C...
Forcal是一个对字符表达式进行编译计算的动态链接库,具有数值计算、关系运算、逻辑运算、字符处理、流程控制、函数调用等许多的可编程功能。它的部分开发文档是由C++开发,有的用Delph开发,还有一少部分用到了VB,这就铸就了它不但可以在C++开发环境下调用,也可在VB和DELPHI中方便调用,很方便。
-Forcal is a calculation of the character expression to compile a dynamic link library, with numerical calculation, relational operators, logical operators, character handling, process control, function calls, and many other programmable features. It is part of the development documentation developed by the C++, some of Delph development, there is a small part of the use of the VB, which cast it could not only C++ development environment called VB and DELPHI can also be conveniently invoked, it is convenient .
- 2022-11-25 10:30:03下载
- 积分:1
-
Java Swing开发的吃豆子游戏源代码下载
这是一款由java swing框架编写的吃豆子游戏,高仿红白机类游戏吃豆子。是一款不错的java游戏,是完全基于java实现的吃豆子游戏源码。画面上有一个吃豆人和一群怪物,你需要用方向键控制吃豆人移动吃掉路上的小豆子。一旦吃豆人遇到怪物被吃掉的时候,就失去一条生命,游戏开始总共3条生命,3条生命使用完就游戏结束。游戏中随机出现大豆子,吃豆人吃掉大豆子,在一定时间内可以吃掉怪物,将怪物关进监狱一段时间。游戏中还有随机的水果道具,吃掉可以增加更多积分。
- 2022-12-13 21:35:03下载
- 积分:1
-
用platformbuild平台编译调试。是关于用信号量来处理同步事件的程序!
用platformbuild平台编译调试。是关于用信号量来处理同步事件的程序!-Platformbuild compiled with debugging platform. Is about the use of semaphores to handle synchronization events program!
- 2022-01-22 16:07:32下载
- 积分:1
-
酒店管理系统
酒店管理系统
酒店管理系统是一个基于 web 的酒店管理软件。它是可扩展和准备无限的酒店、 用户、 客房和客人。
软件的功能包括收入管理、 收益管理、 订票管理、 天率管理、 预订日历、 客户关系管理、 检查插件及检查出局管理、 POS & 开本管理、 发票和收据和会计文件报告。
请点击左侧文件开始预览 !预览只提供20%的代码片段,完整代码需下载后查看 加载中 侵权举报
- 2022-05-22 22:24:06下载
- 积分:1
-
c# images image processing, functional images loaded, red wedge, yellow wedge, g...
c#图像处理,功能图像加载,红楔,黄楔,绿滤膜,灰度处理,增加图像亮度
- 2022-03-02 19:14:41下载
- 积分:1
-
一个象示波器一样的界面,他可以同时实时显示8个信号曲线,并且可以滚动显示...
一个象示波器一样的界面,他可以同时实时显示8个信号曲线,并且可以滚动显示-an oscilloscope as the same interface, he can show the real-time signal eight curves, and can show rolling
- 2023-08-11 04:15:03下载
- 积分:1
-
Can be back to the desktop toolbar, Oh do not know any use to you,
可以缩回到桌面上的工具条,,呵呵不知道对你们有用吗,-Can be back to the desktop toolbar, Oh do not know any use to you,
- 2023-08-24 07:40:03下载
- 积分:1
-
License Options file and may replace Named Users for a Program. whether temporar...
License Options file and may replace Named Users for a
Program, whether temporarily or not, no more than four (4)
times per year, prov
file never exceeds the number licensed per Program.
Portions of the Programs may be installed on individual
computers to accelerate startup times, as long as the-License Options file and may replace Named Users for a Program. whether temporarily or not. no more than four (4) times per year. 577 file never exceeds the number licensed per Program. Portions of the Programs may be instal led on individual computers to accelerate star tup times, as long as the
- 2022-12-31 05:10:03下载
- 积分:1