Delphiでスレッドを使用する

Delphiでスレッドを使用する

Delphiで簡単にスレッドを使用する方法です。

synchronizeはよく使用します????

 

関数の内容

uses System.Classes, System.SysUtils, Vcl.Forms;

procedure Wait(Proc: TProc);
var
  Thread: TThread;
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);
guest
0 Comments
Inline Feedbacks
View all comments