spcomm接收数据函数
procedure TForm1.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;
BufferLength: Word);
var
tmpArray:array[0..4096] of Byte;
ArraySize,i: DWORD;
Count:DWORD;
tmpStr:string;
pStr:PChar;
begin
if Check1.Checked then
begin
pStr:=Buffer;
tmpStr:=string(pStr);
Dec(PStr); {pstr:=pstr-1; }
for i:=0 to Length(tmpStr)-1 do
begin
inc(PStr); {pstr:=pstr+1; }
tmpArray[i]:=Byte(PSTR^);
Memo2.Lines.Add(IntToHEX(Ord(tmpArray[i]),2));
end;
exit;
end;
pStr:= Buffer;
memo2.Lines.Add(pStr);
end;
谁能帮忙给注释一下啊?
哪个变量是接收到的数据16进制?