Solved

Hide + Read Only

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Multiple image collision 13 81
Delphi: ForceDirectory plain function 7 42
Find and Replace Stream with 0s 8 69
Delphi: Connect to running MS Outlook 4 125
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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
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…

820 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