登录
首页 » Windows开发 » 文件修改监控

文件修改监控

于 2022-03-10 发布 文件大小:1.08 kB
0 181
下载积分: 2 下载次数: 1

代码说明:

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循环。     {   

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • regular expression syntax processing software demonstrations illustrate the oper...
    表达式语法处理过程说明 这个软件演示了基于操作符优先级的表达式处理算法,属于很经典的算法。详细的演示了处理过程的每个动作以及辅助栈、表的使用。对学习《编译原理》和《数据结构》中的相关内容会有所帮助。 关于此算法的详细描述请见《数据结构》(清华出版社)。 软件使用方法,可以直接采用程序样例中的表达式(-9.3*((8+2-3*6/2-0.8)+(-64))),也可以在表达式输入的文本框中输入一个新的表达式(限数字、基本运算符、括号),先点击“初始化计算”按钮,然后点击“演示”按钮,每次一步。在此过程中,请观察“操作符号栈”、“操作数栈”、“操作数对照表”的变化情况,以及每次读取的当前词和当前动作。 题外话:觉得许多软件开发人员有一种只重视程序语言和技巧,而忽视算法设计的倾向。记得有个很出名的说法:程序=算法+数据结构。当然现在软件领域出现了许多新的动向,但基本功仍应重视。颖易教育软件工作室主页:http://www.yingyi.net电子邮件:yingyi@yingyi.net,true_yingyi@etang.com电话:(010)63522531-regular expression syntax processing software demonstrations illustrate the operator based on the priority of expression processing algorithm, a very classic algorithms. A detailed demonstration of the process every movement and auxiliary stack, table use. The study "Compiler Principle" and "data structure" of the content will be helpful. This algorithm on a detailed description, see "Data Structure" (Tsinghua University Press). Use of the software can be used directly in the sampl
    2022-03-19 01:12:37下载
    积分:1
  • 如果您的公司运行多个数据库,您可以在数据库之间切换。S.
    If your company runs more than one database, you may switch between databases. Simply click on the name of the database shown in the thin gray line above the ServSuite logo. Your current database name follows “Your current company is:”. Once selected, a screen will pop up with a drop-down menu, where you can select whichever database you would like to use. Once the correct database is selected, simply click “OK-If your company runs more than one database, you may switch between databases. Simply click on the name of the database shown in the thin gray line above the ServSuite logo. Your current database name follows “Your current company is:”. Once selected, a screen will pop up with a drop-down menu, where you can select whichever database you would like to use. Once the correct database is selected, simply click “OK
    2022-09-18 18:45:03下载
    积分:1
  • Twain for win32,C++ Builder写的,请在你的程序中加以改进使用
    Twain for win32,C++ Builder写的,请在你的程序中加以改进使用-Twain for win32, C Builder wrote, Please in your procedures to be used to improve
    2022-12-03 07:30:03下载
    积分:1
  • Winform自制启动画面
    一般软件在启动的时候都会有一个启动画面,这个启动画面是为了系统启动时进行一些验证或者加载资源, 这样能达到一种效果:应用程序不会出现”假死“现象。如果直接启动应用程序,进入界面的时候再去加载应用程序 所需要的一些资源,这个时候界面就会出现卡死现象。可以稍微改动,就可以实现自己的效果了,
    2022-10-04 23:05:03下载
    积分:1
  • Hash查找的C++类
    Hash查找的C++类,.h,.cpp文件,有演示代码,给出城市关键字和ID,还可以自己添加哈希函数
    2022-04-18 22:29:19下载
    积分:1
  • 每次启动随机数都不一样,实现真正意义上的全局随机数
    每次启动随机数都不一样,实现真正意义上的全局随机数-each start random number is different, and genuine sense of the overall situation Random Number
    2022-03-23 06:45:12下载
    积分:1
  • 建立哈夫曼树和哈夫曼编码的程序,每一行都有详细的注解,比较适合初学者...
    建立哈夫曼树和哈夫曼编码的程序,每一行都有详细的注解,比较适合初学者-The establishment of Huffman trees and Huffman coding procedure, each line has a detailed annotation, more suitable for beginners
    2023-04-12 19:40:03下载
    积分:1
  • 通用网络考试系统论文+代码 本系统根据软件工程面向对象思想,提出“通用网络考试系统”设计与实现,通过计算机管理,实现提高效率,增强准确性,最大限度减少不必要...
    通用网络考试系统论文+代码 本系统根据软件工程面向对象思想,提出“通用网络考试系统”设计与实现,通过计算机管理,实现提高效率,增强准确性,最大限度减少不必要的损失。 本课题主要研究内容: 1.拟实现题库录入; 2.智能组卷; 3.随机抽卷; 4.考试设定。 -Network Test System General Papers+ code of the system based on object-oriented software engineering thinking, the " Universal Network Test System," Design and realization of computer management and improve efficiency, enhance accuracy, minimize unnecessary loss. The main research topics: 1. Entry questions to be achieved 2. Intelligent Paper 3. Volume random 4. Test set.
    2022-03-07 03:10:37下载
    积分:1
  • 自动生成虚拟设备驱动(VXD),用vc++编译
    自动生成虚拟设备驱动(VXD),用vc++编译-Automatic generation of virtual device driver (VXD), with vc++ Compiler
    2022-08-06 11:17:41下载
    积分:1
  • 很简单的mp3播放器,教你如何实现mp3的实现方法
    很简单的mp3播放器,教你如何实现mp3的实现方法-Very simple mp3 player, mp3 teach you how to achieve the realization of methods
    2022-02-11 15:23:04下载
    积分:1
  • 696516资源总数
  • 106459会员总数
  • 0今日下载