ImageEn, unit iexWindowsFunctions |
|
TIEFolderWatch
Declaration
TIEFolderWatch = class(TComponent)
public
constructor Create();
destructor Destroy; override;
procedure Start(const WatchPath: string = '');
procedure Stop();
function Running(): Boolean;
published
property AutoStart: Boolean;
property WatchSubTree: Boolean;
property WatchOptions: TWatchOptions;
property WatchActions: TWatchActions;
property BufferSize: Integer;
property Path: string;
property OnNotify: TFileChangeNotifyEvent;
property OnChange: TNotifyEvent;
property OnError: TOnError;
end;
Description
Component that automatically notifies changes to files within a specified folder. Used by
TImageEnFolderMView.
| Demos\PDF\PDFPrinter\PdfPrinter.dpr |
// When an image is added to C:\Images\, display it in a TImageEnView
procedure TForm1.FormCreate(Sender: TObject);
begin
IEFolderWatch1.OnNotify := IEFolderWatch1Notify;
IEFolderWatch1.Start('C:\Images\');
end;
procedure TForm1.IEFolderWatch1Notify(const Sender: TObject; const Action:
TWatchAction; const FileName: string);
begin
if Action = waAdded then
ImageEnView1.IO.LoadFromFile( Filename );
end;
Attribution
Based on Cromis.DirectoryWatch by Iztok Kacin, Cromis (iztok.kacin@gmail.com).