procedure TFormMain.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;
BufferLength: Word);
var s:string;
begin
SetLength(s,BufferLength);
move(buffer^,pchar(s[1])^,bufferlength);
showmessage(s);
end
几位大侠,不知道我这样写的是不是能对呢,但实际上我这样运行的时候,执行到Move那一句的时候,会提示“Access violation ad address ……”这类的错误,使用Pchar(Buffer)^也会出现这种提示,是不是我哪的语法还不对呢?
VOID CopyMemory(
PVOID Destination, // pointer to address of copy destination
CONST VOID *Source, // pointer to address of block to copy
DWORD Length // size, in bytes, of block to copy
);