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

文件修改监控

于 2022-03-10 发布 文件大小:1.08 kB
0 264
下载积分: 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 个回复

  • wince驱动程序的特点和主要驱动的开发流程,以及wince操作系统的相关介绍。...
    wince驱动程序的特点和主要驱动的开发流程,以及wince操作系统的相关介绍。-wince driver characteristics and the main flow-driven development, as well as related operating systems introduce wince.
    2022-03-04 04:30:21下载
    积分:1
  • Windows CE开发初步,wince入门必读资料
    Windows CE开发初步,wince入门必读资料-Windows CE to develop the initial, wince data entry reading
    2022-02-26 23:07:35下载
    积分:1
  • 非常好用的网吧网络监控系统,可以有针对性的设置,欢迎使用!...
    非常好用的网吧网络监控系统,可以有针对性的设置,欢迎使用!-Internet cafes are very easy to use network monitoring systems, can have specific settings, Welcome!
    2022-01-27 12:00:00下载
    积分:1
  • livemedia555库源代码。包括BasicUsageEnvironment,groupsock,liveMedia,UsageEnvironment基本库...
    livemedia555库源代码。包括BasicUsageEnvironment,groupsock,liveMedia,UsageEnvironment基本库,testProgs,mediaServer库。-livemedia555 library source code. Including BasicUsageEnvironment, groupsock, liveMedia, UsageEnvironment basic library, testProgs, mediaServer library.
    2023-02-05 03:40:04下载
    积分:1
  • 交通分布三阶计算器
    大三学生平时做的一个小程序,只能用于三阶...
    2022-01-26 06:02:00下载
    积分:1
  • hello word
    hello word --ficest-hello word--ficest
    2022-04-26 09:13:20下载
    积分:1
  • Templates are among the most powerful features of C++, but they are too often ne...
    Templates are among the most powerful features of C++, but they are too often neglected, misunderstood, and misused. C++ Templates: The Complete Guide provides software architects and engineers with a clear understanding of why, when, and how to use templates to build and maintain cleaner, faster, and smarter software more efficiently.
    2022-02-04 13:28:28下载
    积分:1
  • 一个程序,主要解决窗口不能切换的问题
    一个程序,主要解决窗口不能切换的问题 -A program, the main window can not switch to solve the problem
    2022-08-24 21:05:13下载
    积分:1
  • E统天下
    E统天下--织网梦 ...背景不同。Java是基于C++、面向计算机程序 设计...代替。 (2)JavaScript 源代码无须编译 嵌入HTML...则与之不同。Java的源代码必须进行编译,成为 存在...中的一部分,以一般的文本编辑器就可以连同HTML一... www.51foru.com/index008jsjc.htm 19K 2003-12-10 - 百度快照 C Java PHP Perl Python的程序代码美化工具使用 ...php) 一个速度很快的C/C++/Java源代码美化工具。 astyle比indent好在 有很多成套的的风格定义:ansi ...SLICKEDIT这种大型商业文本编辑器等。 解决:对于...==>网页选项==>HTML源代码选单里选择“使用下面... www.chedong.com/tech/indent_tools.html 14K 2005-3-3 - 百度快照 Jedit for Linux Source Code 源代码--eNet软件-world-- Netting dream ... different backgrounds. Java is based on the C-oriented computer programs designed to replace .... (2) do not have JavaScript compiler source code embedded in HTML ... is different. Java source code to be compiled, as exists ... a part of, in general text editor with HTML can be a ... www.51foru.com/index008jsjc.htm 19K 2003-12-10- Baidu snapshot C Java PHP Perl Python the code landscaping tools ... php), a fast C/C/Java source code for landscaping tools. Astyle than indent Fortunately, there are many sets of
    2022-06-27 23:14:04下载
    积分:1
  • 一个验证常数数值是否合法的分析程序
    一个验证常数数值是否合法的分析程序-a constant verification of the legality of numerical analysis program
    2022-10-12 07:35:02下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载