?
Solved

Change read-only attribute of a file through Delphi

Posted on 2003-03-12
3
Medium Priority
?
283 Views
Last Modified: 2010-04-04
I have an application that copies Word or Excel files to a 'archive' location.  Once the files are copied there, they can't be changed, so I need to make them read-only using the application.  This is needed so that the files can be viewed by clicking a link in the app, but can't be changed once they are opened.  Not sure if this is even possible, but thought I'd ask.  Thanks
0
Comment
Question by:mrshanes
3 Comments
 
LVL 6

Accepted Solution

by:
DaFox earned 320 total points
ID: 8119266
Hi.

FileGetAttr(), FileSetAttr()

FileSetAttr('MyFile.dat', FileGetAttr('MyFile.dat') and faReadOnly);

Markus
0
 
LVL 1

Expert Comment

by:Munim
ID: 8119340
Is the file opened by another process, while you want to set the attribute???
0
 

Author Comment

by:mrshanes
ID: 8119468
I guess I should have just checked the damn help file!  Oh well, I was in a hurry.  Thanks for the quick reply Markus!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Suggested Courses
Course of the Month9 days, 1 hour left to enroll

621 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