我試圖創建一個運行時線程,但線程表現異常,代碼沒有畫布引用。線程在桌面上寫入
procedure TBruteThread.Execute;
var
j: Integer;
begin
inherited;
FreeOnTerminate:=True;
for j:=1 to StrToInt(Form1.Edit1.Text) do begin
if Terminated then break;
Form1.Label2.Caption:=IntToStr(j);
end;
Form1.Label2.Caption:='Thread is destroyed';
Self.Terminate;
end;
有人有任何想法解決這個奇怪的問題?
某個地方可能有人想要這樣做的目的。 –
有關VCL和線程的更多信息,請參見['delphi中的線程安全](http://stackoverflow.com/q/17705197/576719)「。 –