Results 1 to 8 of 8

Thread: Setting a file to read only?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    NJ, USA
    Posts
    326
    How do I set a file to read only. There is an html document in my Temporary Internet Files directory that I'd like to make read only. However, Windows will not give me the option to do it.

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    How about SetFileAttributes

  3. #3
    Guest
    Use SetAttr function.
    Code:
    SetAttr "MyFile", vbReadOnly

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    NJ, USA
    Posts
    326

    Thanks

    Thanks guys I'll give it a shot.

  5. #5
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Megatron,
    what about un-read only


    is it

    set attr "myfile", vbNormal

    ??

    Thanks

    Wengang
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  6. #6
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357
    wengang,

    Yes. The vb intrinsic constants for file properties are:
    Code:
    vbNormal    0 Normal (default) 
    vbReadOnly  1 Read-only 
    vbHidden    2 Hidden 
    vbSystem    4 System file 
    vbArchive   32 File has changed since last backup
    The sum of these attributes defines the end result, so if you want a file to be read-only AND hidden, you do this:
    Code:
    SetAttr "Path\FileName.ext", vbReadOnly + vbHidden
    [Edited by seaweed on 10-11-2000 at 02:30 PM]
    ~seaweed

  7. #7
    Guest

    Talking

    I have a data file that can be read my program, i save it as notepad file... how can i make it as write only when they click on the data file... but only readable and writeable by my program... thanks

  8. #8
    Guest
    Use encryption instead of SetAttr for that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width