var getdate:boolean = false;
tms:string[255];
procudure MSCOMM1ondata();
begin
getdate:=true;
end;
现成:
var
tmd:dword;
while not terminateddo
begin
tmd:=gettickcount()+10*1000{10s};
while tmd>gettickcount()do
begin
sleep(1);
if getdate then
begin
getdate:=false;
tms:=mscomm1.input;
exit
end;
end;