Naja, das Problem ist, wenn ich
Delphi-Quellcode:
procedure Thread.Execute;
begin
while true do
begin
//Irgendwas machen
Sleep(10);
end;
end;
benutze, dann wird meine Hauptanwendung blockiert. :/
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
thread =
class(TThread)
procedure Execute;
end;
var
Form1: TForm1;
gthread: thread;
implementation
{$R *.dfm}
procedure thread.Execute;
begin
while true
do
begin
ShowMEssage('
TEST');
Sleep(10);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
gthread := thread.Create(true);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
gthread.Execute;
end;
end.