unit TheThread;

interface

uses Classes;

type
  TMyThread = class(TThread)
  private
    FCount: Integer;
    procedure UpdateData;
  protected
    procedure Execute; override;
  end;

implementation

uses Main, SysUtils, Windows;

procedure TMyThread.UpdateData;
begin
  fMain.st.Caption := IntToStr(FCount);
end;

procedure TMyThread.Execute;
var i: Integer;
begin
 Windows.InvalidateRect(fMain.Handle, nil, True);
 for i := 1 to 2000000 do
  if i mod 10 = 0 then begin
   FCount := i;
   Synchronize(UpdateData);
  end;
 PostMessage(fMain.Handle, WM_ThreadDone, 0, 0);
end;

end.
