Syncharonize(方法名)使用是比较方便的,比如
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
thread1 = class(TThread)
private
procedure ShowtoEdit(i:integer);
{ Private declarations }
protected
procedure Execute;
override;
end;
implementation
uses Unit1;
procedure thread1.Execute;
var i:integer;
begin
for i:=1 to 10000do
ShowtoEdit(i);
end;
procedure thread1.ShowtoEdit(i:integer);
begin
form1.Edit1.Text:=inttostr(i);
end;
end.