Solved

Hide + Read Only

Posted on 2000-04-02
1
126 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now