{
StrNew, StrDispose example
This example uses an edit control and a button on a form. When the button is clicked, memory is allocated for a copy of the text in the edit control, the text is displayed in a message box, and then the memory is deallocated.
} 
uses Sysutils;
procedure TForm1.Button1Click(Sender: TObject);
var
  Temp: PChar;
begin
  // Allocate memory.
  Temp := StrNew(PChar(Edit1.Text));
  ShowMessage(Temp, 'StrNew, StrDispose example', MB_OK);
  // Deallocate memory.
  StrDispose(Temp);
end; 
