HGRhgr:
InPutCount>0表示幵始返回,返回完该值重置位为0,还不能判断吗?我以前是这样做的,不知是否适合你
[阅读: 1033] 2006-01-19 02:07:02
var
LastInputCount: integer=0;
procedure TForm1.ComPortRxChar(Sender: TObject; Count: Integer);
var
Str: String;
begin
repeat
LastInputCount := ComPort.InputCount;
Sleep(10); //等待时间,可设置。
until LastInputCount = ComPort.InputCount; //前后二交比较,看有无增加
LastInputCount := 0;
ComPort.ReadStr(Str, ComPort.InputCount);
Memo.Lines.Add(Str);
end;
还有一种办法是用一个时钟事件,不停的扫描.
PS:有什么好办法,希望到时告诉我一下.