Ultimate Pack

Set/change file attributes - Files & folders - Tips & Tricks - Greatis Delphi Pages

You may use SetFileAttributes function, if you want to set or change file attributes. This example shows, how to set FILE_HIDDEN attribute.

procedure TForm1.Button1Click(Sender: TObject);
  with OpenDialog1 do
    if Execute then
      if SetFileAttributes(PChar(Filename), FILE_ATTRIBUTE_HIDDEN) then
        Caption:='attribute was changed'
        Caption:='attribute was not changed';
Related topics
All information about file

For more
Win32 programmer's reference

Download source

Delphi books recommended by Amazon.com

More Delphi programming books on Amazon.com

Copyright © 1998-2014 Greatis Software