Solved

Hide + Read Only

Posted on 2000-04-02
1
129 Views
Last Modified: 2010-04-04
how to I set the attributes  of a file to Hidden + ReadOnly??? THanks
0
Comment
Question by:nafa2221
1 Comment
 
LVL 17

Accepted Solution

by:
inthe earned 50 total points
ID: 2678067
hi,

you can set file attributes like so:

var
  TestFile: string;
  Attr: Word;
  F: TextFile;
begin
 testfile := 'c:\autoexec.bat';
  if FileExists(TestFile) then
  begin
    Attr := FileGetAttr(TestFile);
    begin
      Attr := (Attr and faReadOnly and faHidden);
      FileSetAttr(TestFile, Attr);
    end;
    AssignFile(F, TestFile);
    Erase(F);
  end;
end.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi XE10 Round Image 2 129
How to renew a Delphi rad-studio licence? 5 65
Multiple image collision 13 76
Tidtcpserver listening on multiports? 1 28
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question