Jump to content
Henry Olive

Folder ReadOnly, Hidden, Normal

Recommended Posts

Good Day

 

I asked a similiar question while ago

According to that replies i made below proc

In my proc HIDDEN  and NORMAL works

but READONLY doesnt work even though i dont get any err.msg.

what am i doing wrong ?

 

Thank You

 

procedure TFolders.RG1Click(Sender: TObject);
  var
  Attr : TFileAttributes;
  FolderPath : String;
begin
  FolderPath:= CDS1FOLDERPATH.AsString;
  Attr:= TPath.GetAttributes(PChar(FolderPath));

 

  if not TDirectory.Exists(FolderPath) then
  begin
     ShowMessage(FolderPath + '  not Exist');
     Abort;

  end;

 

  if RG1.ItemIndex = 0 then  // Read Only - RG1 = Radio Group
     SetFileAttributes(PChar(FolderPath), FILE_ATTRIBUTE_READONLY) else

 

  if RG1.ItemIndex = 1 then  // Hidden
     SetFileAttributes(PChar(FolderPath), FILE_ATTRIBUTE_HIDDEN) else

 

  if RG1.ItemIndex = 2 then // Open (Not Read Only - Not Hidden)
     SetFileAttributes(PChar(FolderPath), FILE_ATTRIBUTE_NORMAL);
end;

 

 

 

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×