VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Obtain properties of a file.

by kAOs (9 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 9th June 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Obtain properties of a file.

Rate Obtain properties of a file.




Dim Shell As New Shell

Private Sub Form_Load()
    MsgBox GetDetailsOf("C:\a.txt", "Comments")
End Sub

Function GetDetailsOf(FileName As String, FieldName As String) As String
    'Get the folder object
    Dim Folder As Folder
    Set Folder = Shell.NameSpace(Left$(FileName, InStrRev(FileName, "\") - 1))
    
    Dim N As Integer
    For N = 1 To 25 'Search the field name
        If Folder.GetDetailsOf(Nothing, N) = FieldName Then
            'If field name matches, get the field value
            GetDetailsOf = Folder.GetDetailsOf(Folder.ParseName(Dir$(FileName)), N)
            Exit Function
        End If
    Next
End Function


Download this snippet    Add to My Saved Code

Obtain properties of a file. Comments

No comments have been posted about Obtain properties of a file.. Why not be the first to post a comment about Obtain properties of a file..

Post your comment

Subject:
Message:
0/1000 characters