⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 here is a small Delphi program called "FolderWatcher". It watches a folder (you can configure in the
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ShellCtrls;

type
  TForm1 = class(TForm)
    LabelFolderName: TLabel;
    LabelChanged: TLabel;
    ShellChangeNotifier1: TShellChangeNotifier;
    Timer1: TTimer;
    Button1: TButton;
    procedure ShellChangeNotifier1Change;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    watchPath:String;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

uses
  iniFiles;


{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var inif:TIniFile;
    appDir,iniFileName:String;
begin
  if paramCount>0 then iniFileName:=paramStr(1)
  else                 iniFileName:='folderwatcher.ini';

  appDir:=extractFilePath(Application.exeName);
  inif:=TIniFile.Create(appdir+iniFileName);
  watchPath:=inif.ReadString('General','WatchPath',appDir);
  if watchPath[2]<>':' then // not an absolute path
    watchPath:=appDir+watchPath;
  inif.Free;

  ShellChangeNotifier1.Root:=watchPath;
  LabelFolderName.Caption  :=LabelFolderName.Caption + watchPath;
//  ShellChangeNotifier1.OnChange;
end;

procedure TForm1.ShellChangeNotifier1Change;
begin
  LabelChanged.Caption:='Folder changed in last 5 seconds';
  Timer1.Enabled:=true;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  LabelChanged.Caption:='';
  Timer1.Enabled:=false;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  close;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -