问题来源: http://www.cnblogs.com/del/archive/2008/11/08/1329543.html#2016234
procedure TForm1.Button1Click(Sender: TObject); var p: Pointer; str: string; size: Integer; begin str := Edit1.Text; size := (Length(str) + 1) * SizeOf(Char); p := GetMemory(size); ZeroMemory(p, size); CopyMemory(p, @str[1], size); ShowMessage(PChar(p)); FreeMemory(p); end;