在德尔法中使用线程
这是在德尔法中轻松使用线程的方法。
只需合理使用synchronize 🙂
函数内容
uses System.Classes, System.SysUtils, Vcl.Forms;
procedure Wait(Proc: TProc);
begin
Thread := TThread.CreateAnonymousThread(procedure()
begin
Proc;
end);
Thread.FreeOnTerminate := True;
Thread.Start;
while not Thread.Finished do Application.ProcessMessages;
end;
使用方法
Wait(procedure() begin // .... 内容 end);











Leave a Reply