1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
void __fastcall TInterface::Button3Click(TObject *Sender)
{
if(SelectDirectory("Choose a directory", "D:\\Documents and Settings\\anonymous\\Bureau", directory))
logFileEdit->Text = directory;
}
void __fastcall TInterface::makeBinButtonClick(TObject *Sender)
{
if(directory == "")
Application->MessageBox("Choose a directory to analyse please", "ERROR", MB_OK);
else
{
AnsiString FilePath = logFileEdit->Text;
TStrings *ListeFichiers = new TStringList;
TSearchRec Infos_fichier;
if (!FindFirst(FilePath+"\\*.*", faAnyFile, Infos_fichier))
{
do
{
ListeFichiers->Add(Infos_fichier.Name);
}
while(!FindNext(Infos_fichier));
}
FindClose(Infos_fichier);
if(ListeFichiers->Count > 2)
{
ListeFichiers->SaveToFile("D:\\Documents and Settings\\anonymous\\Bureau\\nameFile.txt");
Application->MessageBox("File created", "ERROR", MB_OK);
}
else
Application->MessageBox("There are no files in this directory", "ERROR", MB_OK);
}
} |
Partager