05.11.2010, 11:34
|
|
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
а в справке не почитать?
Цитата:
TThread.Terminate
Signals the thread to terminate by setting the Terminated property to True.
procedure Terminate;
Description
Terminate sets the thread’s Terminated property to True, signaling that the thread should be terminated as soon as possible. Unlike the Windows API TerminateThread, which forces the thread to terminate immediately, the Terminate method merely requests that the thread terminate. This allows the thread to perform any cleanup before it shuts down.
For Terminate to work, the thread's Execute method and any methods that Execute calls should check Terminated periodically and exit when it's True.
|
Код:
var
MyClientThread: TMyClientThread;
procedure TForm1.Button1Click(Sender: TObject);
begin
MyClientThread.Terminate;
end;
procedure TMyClientThread.Execute;
begin
while not Terminated do
begin
...
end;
end;
__________________
Пишу программы за еду.
__________________
|