OXygen DirectorySpy delphi版文件监控
上代码:O2DirSpy.pas[delphi]{====================================================================}{ TOxygenDirectorySpy Component, v1.6 c 2000-2001 Oxygen Software }{--------------------------------------------------------------------}{ Written by Oleg Fyodorov, delphi@oxygensoftware.com }{ http://www.oxygensoftware.com }{====================================================================}unit O2DirSpy;inte易做图ceuses Classes, Controls, Windows, SysUtils, ShellApi, Dialogs, Messages, FileCtrl;typeTDirectoryChangeType = (ctNone, ctAttributes, ctSize, ctCreationTime, ctLastModificationTime, ctLastAccessTime, ctLastTime, ctCreate, ctRemove);TOxygenDirectorySpy = class;TDirectoryChangeRecord = recordDirectory : String;FileFlag : Boolean; // When True, ChangeType applies to a file; False - ChangeType applies to DirectoryName : String; // Name of changed file/directoryOldTime, NewTime : TDateTime; // Significant only when ChangeType is one of ctCreationTime, ctLastModificationTime, ctLastAccessTime, ctLastTimeOldAttributes, NewAttributes : DWord; // Significant only when ChangeType is ctAttributesOldSize, NewSize : DWord; // Significant only when ChangeType is ctSizeChangeType : TDirectoryChangeType; // Describes a change type (creation, removing etc.)end;TSpySearchRec = recordTime: Integer;Size: Integer;Attr: Integer;dwFileAttributes: DWORD;ftCreationTime: TFileTime;ftLastAccessTime: TFileTime;ftLastWriteTime: TFileTime;nFileSizeHigh: DWORD;nFileSizeLow: DWORD;end;TFileData = classprivateFSearchRec : TSpySearchRec;Name: TFileName;FFound : Boolean;publicconstructor Create;procedure Free;end;TFileDataList = class(TStringList)privatefunction NewFileData(const FileName : String; sr : TSearchRec) : TFileData;function GetFoundCount : Integer;publicproperty FoundCount : Integer read GetFoundCount;destructor Destroy; override;function AddFileData(FileData : TFileData) : Integer;function AddSearchRec(const Directory : String; sr : TSearchRec) : Integer;procedure Delete(Index : Integer); override;procedure Clear; override;procedure SetFound(Value : Boolean);end;TReadDirChangesThread = class(TThread)privateFOwner : TOxygenDirectorySpy;FDirectories : TStringList;FHandles : TList;FChangeRecord : TDirectoryChangeRecord;FFilesData,FTempFilesData : TFileDataList;pHandles : PWOHandleArray;procedure ReleaseHandle;procedure AllocateHandle;procedure ReadDirectories(DestData : TFileDataList);procedure CompareSearchRec(var srOld, srNew : TSpySearchRec);protectedprocedure Execute; override;procedure Notify;publicconstructor Create(Owner : TOxygenDirectorySpy);destructor Destroy; override;procedure Reset;end;TChangeDirectoryEvent = procedure (Sender : TObject; ChangeRecord : TDirectoryChangeRecord) of object;TOxygenDirectorySpy = class(TComponent)privateFThread : TReadDirChangesThread;FEnabled,FWatchSubTree : Boolean;FDirectories : TStrings;FOnChangeDirectory : TChangeDirectoryEvent;procedure SetEnabled(const Value : Boolean);procedure CheckDirectories;procedure SetDirectories(const Value : TStrings);procedure SetWatchSubTree(const Value : Boolean);protectedprocedure DoChangeDirectory(ChangeRecord : TDirectoryChangeRecord);publishedproperty Enabled : Boolean read FEnabled write SetEnabled;property Directories : TStrings read FDirectories write SetDirectories;property WatchSubTree : Boolean read FWatchSubTree write SetWatchSubTree;property OnChangeDirectory : TChangeDirectoryEvent read FOnChangeDirectory write FOnChangeDirectory;publicconstructor Create(AOwner : TComponent); override;destructor Destroy; o补充:软件开发 , Delphi ,
上一个:程序隐藏状态栏全屏显示
下一个:Delphi 7 控件安装
- 更多Director疑问解答:
- Director MX 2004教程--Director与Flash,竞争还是合作?
- Director MX 2004教程--常用多媒体编著软件
- Director MX 2004教程--哪些人适合使用Director
- 关于多媒体程序运行速度的研究
- 谈谈Director作品的发布模式
- Director MX 2004教程--用Lingo语法和javascript实现同一功能
- Director中的属性
- Director MX 2004教程--创建新的演员表
- Director 疑难解答(5)
- Director的“洋葱皮”技术介绍(2)
- Director的“洋葱皮”技术介绍(1)
- Director MX 2004教程--演员的管理
- Director MX 2004教程--演员窗口
- Director MX 2004教程--提高开发效率
- Director MX 2004教程--Director MX 2004都支持些什么?