5,388
社区成员
发帖
与我相关
我的任务
分享
procedure TForm1.FormCreate(Sender: TObject);
var
Mscomm1:TMSComm;
begin
Mscomm1:=TMSComm.Create(nil);
Mscomm1.InBufferCount :=0; // 清空接收缓冲区
Mscomm1.InputLen :=0; // Input读取整个缓冲区内容
Mscomm1.RThreshold :=1; // 每次接收到字符即产生OnComm事件
MsComm1.OnComm:=ComGetData;
end;
procedure TForm1.ComGetData(Sender:TObject);
begin
if (sender is TMSComm) then
if (Sender as TMSComm).CommEvent = 2 then
Memo1.text:=Memo1.Text+(sender as TMSComm).Input;
end;