//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "StrDispose.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: StrDispose
// Routine: SysUtils.StrDispose
// Routine: SysUtils.StrNew

// BeginCode
/*
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.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  // Allocate memory.
  char* psz = StrNew(Edit1->Text.t_str());
  Application->MessageBox(
	Edit1->Text.c_str(),
	L"StrNew, StrDispose example",
	MB_OK);
  // Deallocate memory.
  StrDispose(psz);
}
// EndCode
// EndExample: StrDispose
//---------------------------------------------------------------------------
