📄 dirnotify.h
字号:
//---------------------------------------------------------------------------
#ifndef DirNotifyH
#define DirNotifyH
//---------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TNotificationThread;
typedef Shortint TNotifyFilter;
namespace TNotifyFilters
{
static const Shortint nfFileName = FILE_NOTIFY_CHANGE_FILE_NAME;
static const Shortint nfDirName = FILE_NOTIFY_CHANGE_DIR_NAME;
static const Shortint nfAttributes = FILE_NOTIFY_CHANGE_ATTRIBUTES;
static const Shortint nfSize = FILE_NOTIFY_CHANGE_SIZE;
static const Shortint nfLastWrite = FILE_NOTIFY_CHANGE_LAST_WRITE;
static const Shortint nfSecurity = FILE_NOTIFY_CHANGE_SECURITY;
}
//---------------------------------------------------------------------------
class PACKAGE TDirNotify : public TComponent
{
private:
bool FEnabled;
bool FWatchSubTree;
AnsiString FPath;
TNotifyFilter FFilter;
TNotifyEvent FOnChange;
TNotificationThread *FNotificationThread;
void __fastcall SetEnabled(bool Value);
void __fastcall SetFilter(Shortint Value);
void __fastcall SetOnChange(TNotifyEvent Value);
void __fastcall SetPath(AnsiString Value);
void __fastcall SetWatchSubTree(bool Value);
void __fastcall RecreateThread(TObject *Sender);
protected:
public:
__fastcall TDirNotify(TComponent* Owner);
void __fastcall Change(void);
__published:
__property bool Enabled = {read = FEnabled, write = SetEnabled, default = 0};
__property TNotifyFilter Filter = {read = FFilter, write = SetFilter, nodefault};
__property TNotifyEvent OnChange = {read = FOnChange, write = SetOnChange};
__property AnsiString Path = {read = FPath, write = SetPath};
__property bool WatchSubTree = {read = FWatchSubTree, write = SetWatchSubTree};
};
//---------------------------------------------------------------------------
class TNotificationThread : public TThread
{
private:
TDirNotify *DirNotifyOwner;
protected:
void __fastcall Execute();
public:
__fastcall TNotificationThread (bool CreateSuspended, TObject *Sender);
void __fastcall DoChange(void);
};
//---------------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -