/----------------------------------------------------------------------------
//Borland C++Builder
//Copyright (c) 1987, 1998-2002 Borland International Inc. All Rights Reserved.
//----------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "diroutx.h"
#include <iostream>
#include <fstream>
//---------------------------------------------------------------------------
#pragma link "cdiroutl"
#pragma resource "*.dfm"
TFormMain *FormMain;
//---------------------------------------------------------------------------
__fastcall TFormMain::TFormMain(TComponent* Owner)
: TForm(Owner)
{
FileListBox1->Mask=Edit1->Text;
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::DirectoryOutline1Change(TObject *Sender)
{
// FileListBox1->Directory=DirectoryOutline1->Directory;
}
//---------------------------------------------------------------------
void __fastcall TFormMain::DriveComboBox1Change(TObject *Sender)
{
// DirectoryOutline1->Drive=DriveComboBox1->Drive;
}
//---------------------------------------------------------------------
void __fastcall TFormMain::Edit1Change(TObject *Sender)
{
FileListBox1->Mask=Edit1->Text;
}
//---------------------------------------------------------------------
void __fastcall TFormMain::FileListBox1Change(TObject *Sender)
{
const int size=1024;
char buffer[size];
memset(buffer,0,size);
HFILE file=_lopen(FileListBox1->FileName.c_str(),OF_READ);
if (file!=NULL) _lread(file,buffer,1);
// for (int i=0;i<1023;i++) if (buffer[i]==0) buffer[i]='.';
sz=buffer[0];
Memo1->Text=sz;
_lclose(file);
}
//---------------------------------------------------------------------
void __fastcall TFormMain::FileListBox1Enter(TObject *Sender)
{
// The first item in the box is not yet selected, let's take care of that.
if (FileListBox1->ItemIndex == 0)
{
SendMessage(FileListBox1->Handle, LB_SETSEL, TRUE, FileListBox1->ItemIndex );
FileListBox1->OnChange(Sender);
}
}
//---------------------------------------------------------------------------

void __fastcall TFormMain::Button1Click(TObject *Sender)
{
if (sz<108) {
sz=sz+20;
Memo2->Text=sz;
Wir();
} else {
Memo2->Text="Túl sok kredit hozzáadás!";
}
}
//---------------------------------------------------------------------------

void __fastcall TFormMain::Button2Click(TObject *Sender)
{
if (sz<60) {
sz=sz+60;
Memo2->Text=sz;
Wir();
} else {
Memo2->Text="Túl sok kredit hozzáadás!";
}
}
//---------------------------------------------------------------------------

void __fastcall TFormMain::Button3Click(TObject *Sender)
{
if (sz<8) {
sz=sz+120;
Memo2->Text=sz;
Wir();
} else {
Memo2->Text="Túl sok kredit hozzáadás!";
}
}
//---------------------------------------------------------------------------
void TFormMain::Wir()
{
const int size=1024;
char buffer[size];
memset(buffer,0,size);
buffer[0]=sz;
HFILE file=_lopen(FileListBox1->FileName.c_str(),OF_WRITE);
if (file!=NULL) _lwrite(file,buffer,1);
_lclose(file);
Memo1->Text="A kreditek kiírva!";

}