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

你可能感兴趣的:(c#)