niedziela, 5 lutego 2017

File information (C++ Builder)




void __fastcall TForm1::Button1Click(TObject *Sender)
{
 Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
 AnsiString text_application=Application->ExeName;
 TSearchRec file_info;
 ListBox1->Items->Add("Name my application: "+text_application);
 ListBox1->Items->Add("Directory name: "+ExtractFileDir(text_application));
 ListBox1->Items->Add("Disc label: "+ExtractFileDrive(text_application));
 ListBox1->Items->Add("Extract file: "+ExtractFileExt(text_application));
 ListBox1->Items->Add("Path: "+ExtractRelativePath(GetCurrentDir(),text_application));
 ListBox1->Items->Add("Full name: "+ExtractShortPathName(text_application));
 if(FindFirst(text_application,faAnyFile,file_info)!=0)
 {
return;
 }
 FindClose(file_info);
 ListBox1->Items->Add("Size: "+IntToStr(file_info.Size) );
 ListBox1->Items->Add("Attr: "+IntToStr(file_info.Attr));
 ListBox1->Items->Add("Last modification: "+DateTimeToStr(FileDateToDateTime(file_info.Time)));

}

Brak komentarzy:

Prześlij komentarz