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

#include <vcl.h>
#pragma hdrstop

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

// BeginCode
/*
The following example uses an edit control and a button on a
form. When the button is clicked, the current directory is
searched for the filename specified in the edit control. A
message box indicates whether the file is found.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  AnsiString asFileName = FileSearch(Edit1->Text, GetCurrentDir());
  if (asFileName.IsEmpty())
    ShowMessage(AnsiString("Couldn't find ") + Edit1->Text + ".");
  else
    ShowMessage(AnsiString("Found ") + asFileName + ".");
}

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  Label2->Caption = GetCurrentDir();
}
// EndCode
// EndExample: FileSearch
//---------------------------------------------------------------------------
