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.
...全文
14 4 打赏 收藏 举报
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
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!
  • 打赏
  • 举报
回复
相关推荐
发帖
网络通信/分布式开发
加入

1584

社区成员

Delphi 网络通信/分布式开发
申请成为版主
帖子事件
创建了帖子
2003-12-12 06:16
社区公告
暂无公告