Results 1 to 4 of 4

Thread: Changing a file Info

  1. #1

    Thread Starter
    Hyperactive Member razzaj's Avatar
    Join Date
    Oct 1999
    Location
    jounieh
    Posts
    261
    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 ....


    - regards -
    - razzaj -

  2. #2
    New Member
    Join Date
    Jul 2000
    Location
    Saarbrücken, Germany
    Posts
    10
    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

  3. #3
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184
    Can also use the FileSystemObject, ie

    object.Attributes [= newattributes]

    See help files on the subject, or ask for sample

  4. #4
    Guest
    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
  •  



Click Here to Expand Forum to Full Width