type
Myzhiling = record
command: Integer;
end; ClientInfo = record
PcName:string[5];//名称
passwd:string[20];//密码
command:string[5];//指令
Ver:string[2]; //版本
Text:string; //附加信息
end; TMyThread = class(TThread)
private
F_info:ClientInfo;
F_Athread: TIdPeerThread;
protected
procedure DoTerminate; override;
public
constructor Create(C_info:ClientInfo; const C_Athread: TIdPeerThread);
destructor Destroy; override;
procedure Execute; override;
end;implementationuses main;{ TCheckThread }constructor TMythread.Create(C_info:ClientInfo; const C_Athread: TIdPeerThread);
begin
inherited Create(False);
FreeOnTerminate := True; F_info:=C_info;
F_Athread := C_Athread;
end;destructor Tmythread.Destroy;
begin
inherited Destroy;
end;procedure TMythread.DoTerminate;
begin
inherited DoTerminate;
end;procedure TMythread.Execute;
begin
with Form1 do
begin
EnterCriticalSection(cs);
if F_info.command='ADD'then
begin
form1.listview1.items.add................
end;
LeaveCriticalSection(cs);
Terminate;
end;//=========================procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
var
C_info:ClientInfo;
begin
// if (not AThread.Terminated) and (AThread.Connection.Connected=True) then
begin
AThread.Connection.ReadBuffer(C_info,SizeOf(C_info));
TMyThread.Create(C_info,AThread);
end;
end;
解决方案 »
- 如何利用IdFTP1.put()把文件上传到网站指定的目录下?
- 我要自杀,你们别拦我...
- 今天遇到的两天头痛问题请大家赐教。
- 怎样设置Web Service 客户端调用时的超时时间?
- delphi如何访问远程数据库?
- 大家进来谈谈,在用delphi时常用的快捷方式,以及在遇到问题时的解决途径,还有如何运用帮助文件
- 问个问题,关于ADO的简单问题。
- 没想到DirectShow比简单的TMediaPlayer还不如!惨重!
- 是不是分太少了,加50高手快来拿分!!!
- 原来有位朋友说要找WH_CALLWNDPROC钩子的例子代码,我写了一个,有兴趣的可以去下载。
- **************大家给看看这个软件是怎么做的,研究了好几天没结果****************
- 如何实现通过串口控制手机的拨号与拨通?
按照你的上面写法,程序中Form1将会出现停止状态,这是由于Form1将不能其他的访问