关于线程(为什么我用synchronize进不了)
TReceiveThread = class(TThread)
private
FMsg: string;
procedure showme;
protected
procedure Execute; override;
end;
var
FThread: TReceiveThread;
procedure TReceiveThread.showme;
begin
showmessage('123456');
end;
procedure TReceiveThread.Execute;
begin
while not Terminated do
begin
if Form1.IdTCPClient1.Connected then
begin
FMsg := Form1.IdTCPClient1.ReadLn;
FThread.Synchronize(showme);
Sleep(100);
end;
end;
end;
为什么不显示123456呢