Delphi/CB
•  Greatis •  Security •  AppDatabase •  Utilities •  Visual Basic • .NET •  just4fun
Delphi / C++ Builder
Components, utilities and tips for Delphi and C++ Builder developers
Hot Offer
Save your money!
Featured
Ultimate Pack  hot!
Image Editor  new!
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET

...get more...
for Delphi.NET, C#, VB.NET
for Delphi VCL, BCB 3-6

News Tips .NET Software VCL Software Partners  

All information about file
TWin32FindData record contains information about type of file and ExtractFileDir, ExtractFileDrive, ExtractFileExt, ExtractFileName, ExtractFilePath procedures contain information about location of the file.

procedure TForm1.Button1Click(Sender: TObject);
var
  MyS: TWin32FindData;
  FName: string;
  MyTime: TFileTime;
  MySysTime: TSystemTime;
begin
  Memo1.Clear;
  FName:=Edit1.Text;
  with Memo1.Lines do
  begin
    Add('Directory - '+ExtractFileDir(FName));
    Add('Drive - '+ExtractFileDrive(FName));
    Add('Extension - '+ExtractFileExt(FName));
    Add('File name - '+ExtractFileName(FName));
    Add('Path - '+ExtractFilePath(FName));
    Add('');

    FindFirstFile(PChar(FName), MyS);
    case MyS.dwFileAttributes of
      FILE_ATTRIBUTE_COMPRESSED: Add('Attribute - File is compressed');
      FILE_ATTRIBUTE_HIDDEN: Add('Attribute - File is hidden');
      FILE_ATTRIBUTE_NORMAL: Add('Attribute - File has no any attributes');
      FILE_ATTRIBUTE_READONLY: Add('Attribute - Read only file');
      FILE_ATTRIBUTE_SYSTEM: Add('Attribute - System file');
      FILE_ATTRIBUTE_TEMPORARY: Add('Attribute - File for temporary storage');
      FILE_ATTRIBUTE_ARCHIVE: Add('Attribute - Archive file');
    end;

    MyTime:=MyS.ftCreationTime;
    FileTimeToSystemTime(MyTime, MySysTime);
    Add(
      'Time Creation - '+
      IntToStr(MySysTime.wDay)+'.'+
      IntToStr(MySysTime.wMonth)+'.'+
      IntToStr(MySysTime.wYear)+'  '+
      IntToStr(MySysTime.wHour)+':'+
      IntToStr(MySysTime.wMinute));

    MyTime:=MyS.ftLastAccessTime;
    FileTimeToSystemTime(MyTime, MySysTime);
    Add(
      'Last time access - '+
      IntToStr(MySysTime.wDay)+'.'+
      IntToStr(MySysTime.wMonth)+'.'+
      IntToStr(MySysTime.wYear));

    Add('Size - '+IntToStr(MyS.nFileSizeLow));
    Add('Alternate name - '+StrPas(MyS.cAlternateFileName));
  end;
end;

For more
Win32 programmer's reference

Download source


Our Partner
DevArchive.com
Recommended
just4fun
Useful Resources
Win32.hlp Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com
Newsletters
Subscribe to our news!    Subscribe to our news!


Greatis Software Greatis | Security | AppDatabase | Utilities | Delphi/CB | Visual Basic | .NET | just4fun

Contacts | Add to Favorites | Recommend to a Friend | Privacy Policy | Copyright © 1998-2008 Greatis Software