L
lenapu
Unregistered / Unconfirmed
GUEST, unregistred user!
怎么把下面这段用SPCOMM控件接收数据的程序翻译成用MSCOMM控件接收数据啊?
procedure TForm1.Comm1ReceiveData(Sender: TObject;
Buffer: Pointer;
BufferLength: Word);
var
i: integer;
rbuf: array[1..100] of byte;
var
s: string;
begin
SetLength(S, BufferLength);
Move(Buffer^, PChar(S)^, BufferLength);
Memo1.Lines.Add(S);
Memo1.Invalidate;
viewstring := '';
move(buffer^, pchar(@rbuf)^, bufferlength);
showmessage(inttostr(bufferlength));
for i := 1 to bufferlengthdo
begin
viewstring := viewstring + inttohex(rbuf, 2) + '';
end;
viewstring := '接收' + viewstring;
memo1.lines.add(viewstring);
memo1.lines.add('');
end;
谢谢!
procedure TForm1.Comm1ReceiveData(Sender: TObject;
Buffer: Pointer;
BufferLength: Word);
var
i: integer;
rbuf: array[1..100] of byte;
var
s: string;
begin
SetLength(S, BufferLength);
Move(Buffer^, PChar(S)^, BufferLength);
Memo1.Lines.Add(S);
Memo1.Invalidate;
viewstring := '';
move(buffer^, pchar(@rbuf)^, bufferlength);
showmessage(inttostr(bufferlength));
for i := 1 to bufferlengthdo
begin
viewstring := viewstring + inttohex(rbuf, 2) + '';
end;
viewstring := '接收' + viewstring;
memo1.lines.add(viewstring);
memo1.lines.add('');
end;
谢谢!