How do I set the File Attribute to Read Only Permanently

bhalpa
bhalpa used Ask the Experts™
on
Hello Experts,

I want to Set the Read-Only Attribute to a file, Even if the User changes the Attribute in the GUI mode It should not happen.

I think u got the point.I would like to set a file's attribute to Read-Only Permanently, but I should be able to Delete It.

This complete process should be done using WIN32 API calls.
Thanks in Advance.

Bhalpa
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
%listening
What processes/procedures have you tried already?

Joe
Have you tried such things as this?

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvbtips/html/msdn_msdn44.asp

I'm not 100% sure about Read-Only permanently.

Joe
Should you be charging more for IT Services?

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

The link I provided is not a Win32 API call.

Joe

Commented:
Joe,I think they bhalpa is looking to change it permanantly which I don't think is possible.
I agree.

bhalpa could see if someone is trying to change the file attributes and change them back.

Joe

Commented:
Yes,but then an app must be run to change them back.Even if the app was always running in the background,you could boot to a different drive or floppy and then change the attributes and copy it modify it or whatever.
Commented:

Burn the file to a CD....hee hee.  This is actually an OS question.  You need a way to tell the OS that you want to protect that file from modification.  This means that you need to set up users that have only read access to that file and an administrator that has whatever access the want.  The way you might do this would depend on how the system is set up.  If you are connected to a Domain and you are using the NTFS file system permissions then that would be easy enough to do.  However, if you are not set up on a domain then you need to think of some other method.  I think you might be able to share the file between users of the computer but only allow other users read access to the file.  In any case, you will need to set up multiple users on the system of which one user will always have full access to the file and the others are restricted.  What OS are you using?  Is it connected to a Domain?  Do you have NTFS permissions avialable to you?  You can use simple sharing if you don't have NTFS permissions.  Hope that helps.

Author

Commented:
Okay I agree with you all. One more uestion can I disable the property sheet of the file. I meant when you right click and you get the property page/security can i diable that. that would solve my problem.

Once again thanks for all & thanks in advance.
bhalpa
Author of the Year 2009

Commented:
Moderator, my recommended disposition is:

    Accept Enlade's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial