unit filechangenotify;

interface

uses
  Classes,windows,shellapi,main,exploreform,global;

type
  changenotify = class(TThread)
  private
    { Private declarations }
procedure achangeoccured;

  protected
    procedure Execute; override;
  end;

  var
changehand : thandle;

implementation

{ Important: Methods and properties of objects in VCL can only be used in a
  method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure changenotify.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ changenotify }


procedure changenotify.Execute;
begin
changehand:=FindFirstChangeNotification(pchar(config.path),boolean(1),FILE_NOTIFY_CHANGE_SIZE or  FILE_NOTIFY_CHANGE_DIR_NAME or FILE_NOTIFY_CHANGE_FILE_NAME);

while terminated=false do begin
waitforsingleobject(changehand,INFINITE);
synchronize(achangeoccured);
end;
end;

procedure changenotify.achangeoccured;
begin
changeoccured;
FindNextChangeNotification(changehand);
end;

end.