How I do?

xinyuwang01 2003-12-12 06:16:40
Can someone tell me how to use Synchronize method within IdTCPServer.OnExecute event. I want to access some component on a main form and I read that you cannot
access it directly from OnExecute event safely. But when I call Synchronize method where I access main form's component I get Access violation error.
...全文
27 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
qiume 2003-12-13
  • 打赏
  • 举报
回复
// Synchronize example
// This example shows how to call a button抯 click method in a thread-safe manner:


procedure TMyThread.PushTheButton;

begin
Button1.Click();
end;

procedure TMyThread.Execute;
begin
...
Synchronize(PushTheButton);
...
end;
xinyuwang01 2003-12-13
  • 打赏
  • 举报
回复

procedure TServerFrmMain.ServerExecute(AThread: TIdPeerThread);
begin
.
.
.
AThread.Synchronize(test);
.
.
.
end;
Wally_wu 2003-12-13
  • 打赏
  • 举报
回复
Use the Thread approach
aiirii 2003-12-12
  • 打赏
  • 举报
回复
paste the main code here!

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧