|
-
Aug 7th, 2000, 05:32 AM
#1
Thread Starter
Hyperactive Member
hi ;
Anyone has an idea hopw can I change through code the properties of a certain file given it's path and name.
for example I would have a txt box to imput file name ,
then a button to change the state from readonly to read/write ....
-
Aug 7th, 2000, 06:16 AM
#2
New Member
You can do it with API.
Public Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long
Public Declare Function SetFileAttributes Lib "kernel32" Alias "SetFileAttributesA" (ByVal lpFileName As String, _
ByVal dwFileAttributes As Long) As Long
Public Const FILE_ATTRIBUTE_ARCHIVE = &H20
Public Const FILE_ATTRIBUTE_COMPRESSED = &H800
Public Const FILE_ATTRIBUTE_DIRECTORY = &H10
Public Const FILE_ATTRIBUTE_HIDDEN = &H2
Public Const FILE_ATTRIBUTE_NORMAL = &H80
Public Const FILE_ATTRIBUTE_READONLY = &H1
Public Const FILE_ATTRIBUTE_SYSTEM = &H4
Public Const FILE_ATTRIBUTE_TEMPORARY = &H100
-
Aug 7th, 2000, 06:55 AM
#3
Addicted Member
Can also use the FileSystemObject, ie
object.Attributes [= newattributes]
See help files on the subject, or ask for sample
-
Aug 7th, 2000, 07:41 AM
#4
Why not use VB's SetAttr and GetAttr functions?
Code:
SetAttr "MyFile.txt", vbReadOnly
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|