啊,弄懂了,他是这么实现的,我还以为必须通过信号量或waitformulitiobject(忘了怎么写了^_^)
来等待线程句柄
for ip:=IPStart to IPEnddo
begin
if TrIPAborted then
break;
//Only fire a new thread when allowed..
while ThreadCount>=MaxThreadsdo
begin
application.processmessages;
if TrIPAborted then
begin
KillThreads;
break;
end;
end;
ThreadOptions:=ord(cbPing.Checked)+(ord(cbResolve.checked)*2)+(ord(cbTrace.checked)*4)+(ord(cbResolveTrace.checked)*8);
if TrIPAborted then
break;
//NB ip is in Hostbyte Order..swap to Network Order!!
inc(ThreadCount);
TThrIPScan.Create(winsock.htonl(ip),ThreadOptions,tbPackets.Position,tbHops.Position);
end;