很简单的,没啥花头 ,是不是属性设置方面要注意什么?
procedure TfrmMain.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;
BufferLength: Word);
var
viewstring : string;
i:integer;
rbuf:array[0..1024] of byte;
begin
viewstring:='';
Move(Buffer^,pchar(@rbuf)^,BufferLength);
for i:=0 to BufferLength-1 do
begin
viewstring:=viewstring+inttohex(rbuf,2);
viewstring:=viewstring+' ';
end;
memo1.Lines.Add(viewstring);
memo1.Lines.Add('共计:'+inttostr(BufferLength));
Memo1.Invalidate;
end;