Solved

Hide + Read Only

Posted on 2000-04-02
1
131 Views
Last Modified: 2010-04-04
how to I set the attributes  of a file to Hidden + ReadOnly??? THanks
0
Comment
Question by:nafa2221
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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