如下
Function GettimeServer(ComIndex:Intger;Var source,State:String):Boolean;
Var
Timecount,TimeDifference,Time         :Integer;    // 延时时间初值 ,时间差
MessAgeInformation:MSG;
ComTemp:String;
ComIndex:Integer;
Begin
Timecount:=GettickCount;
PublicReturn[ComIndex,0]:='0';    //0表示现在没有处理数据
State:='0';
while True do
   Begin
   TimeDifference:=GettickCount()-Timecount;
    //提供其他程序运行时间
    if (PeekMessage(MessAgeInformation, 0, 0, 0, PM_REMOVE)) then
       Begin
           TranslateMessage(MessAgeInformation);
           DispatchMessage(MessAgeInformation);
       End;
    Application.ProcessMessages ;
    //超时退出
    If TimeDifference>20000 then
       Begin
         TimeDifference:=0;//让超时成为初始值
         Break;
         EXIT;
       End;
   If PublicReturn[ComIndex,0]<>'0' then   //表示现在数据处理收取完成
       Begin
         Result:=True;
         Break;
         EXIT;
       End;
   End;
End;
==============================================================================
以上这个函数,是一个延时函数,根据状态或者超时退出,但是我现在想用多线程解决,表示返回True是是以状态退出,返回False是以超时
===============================================================================
我现在想写个多线程的有返回值的,根据状态或者超时判断,大家指点一下,