H
happyloner
Unregistered / Unconfirmed
GUEST, unregistred user!
我想实现在局域网内一台机器向另外发送一台机器消息,接到消息后
自动弹出对话框显示信息,现在基本功能已经实现了,但在关闭服务器程序时
服务器端会出现异常,EOSError,窗口句柄无效,怎么可以避免这个问题,在服务器
端只写了IdTCPServer的OnExecute事件
procedure Tmainfrm.IdTCPServer1Execute(AThread: TIdPeerThread);
var
S : String;
i : Integer;
begin
S := AThread.Connection.ReadLn(#10#10, 100);
S := Trim(S);
if S <> '' then
begin
with IdTCPServer1.Threads.LockList do
begin
try
for i := 0 to Count - 1 do
begin
aThread := Items;
aThread.Connection.WriteLn(S + #10#10);
end;
try
Beep();
showmessage(S);
//GetMsgfrm.Memo1.text:=S;
//GetMsgfrm.showmodal;
except
end;
finally
IdTCPServer1.Threads.UnlockList;
end;
end;
end;
end;
窗体关闭时
IdTCPServer1.Active:=false;
谢谢了
自动弹出对话框显示信息,现在基本功能已经实现了,但在关闭服务器程序时
服务器端会出现异常,EOSError,窗口句柄无效,怎么可以避免这个问题,在服务器
端只写了IdTCPServer的OnExecute事件
procedure Tmainfrm.IdTCPServer1Execute(AThread: TIdPeerThread);
var
S : String;
i : Integer;
begin
S := AThread.Connection.ReadLn(#10#10, 100);
S := Trim(S);
if S <> '' then
begin
with IdTCPServer1.Threads.LockList do
begin
try
for i := 0 to Count - 1 do
begin
aThread := Items;
aThread.Connection.WriteLn(S + #10#10);
end;
try
Beep();
showmessage(S);
//GetMsgfrm.Memo1.text:=S;
//GetMsgfrm.showmodal;
except
end;
finally
IdTCPServer1.Threads.UnlockList;
end;
end;
end;
end;
窗体关闭时
IdTCPServer1.Active:=false;
谢谢了