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

#include <vcl.h>
#pragma hdrstop

#include "ParamCount.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: ParamCount
// Routine: System.ParamCount
// Routine: System.ParamStr
// Routine: SysUtils.LowerCase
// Routine: SysUtils.Beep
// Method: Forms.TApplication.Terminate

// BeginCode
/*
The following example beeps once for each "beep" passed in
on the command line.  The example terminates the application
if  "exit" is passed in on the command line.  Build the
project to generate a .exe file and then execute that file
from a command line: "ParamCount_proj beep beep exit".
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
//  Use print statements since you can't use the debugger.
//	MessageDlg(
//	  "System ParamStr = " + AnsiString(System::ParamStr(i)),
//	  mtConfirmation, TMsgDlgButtons() << mbOK, 0);
  for (int i=1;i<=ParamCount();i++)
  {
	if (LowerCase(ParamStr(i)) == "beep")
	  Beep();
	else if (LowerCase(ParamStr(i)) == "exit")
	  Application->Terminate();
  }
}
// EndCode
// EndExample: ParamCount
//---------------------------------------------------------------------------
