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;

 

posted @ 2018-06-26 11:23  夏天的西瓜君  阅读(947)  评论(0编辑  收藏  举报