具体消息你自己定义,demo如下:
const
WM_MyMessage = WM_USER + 1;
TMyThread = class(TThread)
private
FWindHandle : THandle
...
protected
procedure Execute;
override;
..
end;
procedure TMyThread.Execute;
begin
while not Terminateddo
begin
...//procced with ur logic
...
end;
//Task terminated;
SendMessage(FWindHandle ,WM_MyMessage, 0,0);
或
PostMessage(FWindHandle ,WM_MyMessage, 0,0);
end;
当然在你的希望收到消息的窗口需要处理此消息(WM_MyMessage)
如:
在你的form中定义如下:
TForm1 = class(TForm)
...
private
procedure MyMessage(var Message : TMessage);
message WM_MyMessage;
...
end;
procedure TForm1.MyMessage(var Message : TMessage);
begin
...
showmessage('my thread end');
end;
不知道还有什么疑问?明天和后天公司要出去秋游,^_^,周一再回你。