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

#include <vcl.h>
#pragma hdrstop

#include "TAppRestore.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: TAppRestore
// Method: Forms.TApplication.Restore
// Event: Forms.TApplication.OnMinimize
// Property: ExtCtrls.TTimer.Enabled
// Property: ExtCtrls.TTimer.Interval

// BeginCode
/*
This example uses a timer on a form. When the application
runs and the user minimizes the application, the timer
starts and the application returns to its normal size when
an OnTimer event occurs.  The timer then shuts down until
the next time the form is minimized.  Be sure to declare the
AppStartTimer method as a public method of TForm1.  Place a
TTimer object in the form and enter Timer1Timer in the OnTimer
event.
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  Application->OnMinimize = AppStartTimer;
  Timer1->Interval = 1000;
}

void __fastcall TForm1::AppStartTimer(TObject *Sender)
{
  Timer1->Enabled = true;
}

//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
  Application->Restore();
  Timer1->Enabled = false;
}
// EndCode
// EndExample: TAppRestore
//---------------------------------------------------------------------------
