unit Main;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, TheThread, Buttons, ExtCtrls;

const WM_ThreadDone = wm_User;

type
  TfMain = class(TForm)
    btnStartThread: TButton;
    st: TStaticText;
    procedure btnStartThreadClick(Sender: TObject);
  private
    T2: TMyThread;
    procedure ThreadDone(var AMessage : TMessage); message WM_ThreadDone;
  end;

var fMain: TfMain;

implementation

{$R *.DFM}

procedure TfMain.btnStartThreadClick(Sender: TObject);
begin
 btnStartThread.Enabled:=false;
 T2 := TMyThread.Create(False);
end;

procedure TfMain.ThreadDone(var AMessage : TMessage);
begin
 btnStartThread.Enabled:=true;
end;

end.
