delphi GetMem使用

procedure TForm12.Button2Click(Sender: TObject);
var
  mystring: PChar;
begin
  GetMem(mystring, 1024);
  GetWindowText(Button1.Handle,mystring,100);
  Label1.Caption := Format('%s:%d', [mystring, strlen(mystring)]);
  FreeMem(mystring);
end;
原文地址:https://www.cnblogs.com/yangxuming/p/9228216.html