Dei uma olhada ai sim. Obrigado pela resposta. Tentei colocar o evento OnTerminate, mas não sei se estou declarando corretamente. Tentei fechar a thread para teste pelo Self.Terminate e ele não achou o evento... Declarei assim: TMyThread = class(TThread)
private
FOnTerminate: TNotifyEvent;
procedure SetOnTerminate(const Value: TNotifyEvent);
protected
procedure Execute; override;
property OnTerminate: TNotifyEvent read FOnTerminate write SetOnTerminate;
end;
procedure TTMyThread.SetOnTerminate(const Value: TNotifyEvent);
begin
MessageBox(0, 'SetOnTerminate!!', 'Teste', MB_TOPMOST);
end;
procedure TTMyThread.Execute;
begin
{... codigos ...}
end; Lembrando que estou tentando previnir que ela seja fechada externamente. Se conseguirmos fazer o OnTerminate funcionar já é um avanço. Obrigado ai. =)