Page 1 of 1

TFindFile

PostPosted: March 10th, 2008, 6:43 pm
by salim
Hi used your greate component TFindFile in my project .
i'm wondering if it's possible to add the Suspend and Resume feature to its Thread it will be very greate .


Regards Salim.

PostPosted: March 16th, 2008, 2:18 am
by Kambiz
I'll do it in the next update.

Thank you

PostPosted: March 21st, 2008, 4:54 pm
by salim
Does the next update take a long time , or maybe 10 or 15 Days :roll:

cause i really need this update .


regards

Salim

PostPosted: March 22nd, 2008, 2:52 pm
by Kambiz
It would take a long long time. :oops:

PostPosted: June 8th, 2008, 6:01 am
by salim
Hi Kambiz could you please do it , cause i really need it as soon as possible .

regards

PostPosted: June 8th, 2008, 6:43 pm
by Kambiz
You can use a TEvent object in your code to implement Suspend and Resume.

Code: Select all
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, FindFile,
  SyncObjs;                                    // don't miss this unit

type
  TForm1 = class(TForm)
    FindFile: TFindFile;
    btnSuspend: TButton;
    btnReume: TButton;
    procedure FormCreate(Sender: TObject);
    procedure FindFileFolderChange(Sender: TObject; const Folder: String;
      var IgnoreFolder: TFolderIgnore);
    procedure FindFileFileMatch(Sender: TObject; const Folder: String;
      const FileInfo: TSearchRec);
    procedure btnSuspendClick(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure btnReumeClick(Sender: TObject);
  private
    { Private declarations }
    Event: TEvent;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Event := TEvent.Create(nil, True, True, '');
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  Event.Free;
end;

procedure TForm1.FindFileFolderChange(Sender: TObject;
  const Folder: String; var IgnoreFolder: TFolderIgnore);
begin
  Event.WaitFor(INFINITE);
  // your code
end;

procedure TForm1.FindFileFileMatch(Sender: TObject; const Folder: String;
  const FileInfo: TSearchRec);
begin
  Event.WaitFor(INFINITE);
  // your code
end;

procedure TForm1.btnSuspendClick(Sender: TObject);
begin
  Event.ResetEvent;
end;

procedure TForm1.btnReumeClick(Sender: TObject);
begin
  Event.SetEvent;
end;

end.