>
>I found this API to set a file attribute
>>
>>
>>DECLARE SHORT SetFileAttributes IN kernel32;
>> STRING lpFileName,;
>> INTEGER dwFileAttributes
>>
>>
>>I assume I set lpFilename to xyz.doc
>>but what do I set dwFileAttributes to make xyz.doc read only?>
>Peter
>
>Another way is by using WSH:
>
>#define READONLY 1
>#define HIDDEN 2
>#define SYSTEM 4
>#define ARCHIVE 32
>oFSO = CreateObject("Scripting.FileSystemObject")
>oFile = oFSO.GetFile("c:\xyz.doc")
>oFile.Attributes = READONLY
>
Alex,
It's better to use the bit manipulation functions. This is because on of the file attribute bits is, itself, read-only (FILE_ATTRIBUTE_DIRECTORY 0x10) and may cause an error. Further, setting the attributes directly clears the other bits such as the archive bit.
George
Ubi caritas et amor, deus ibi est