by liaqat fayyaz (10 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 1st May 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Retrieves information about an object in the file system, such as a file, a folder, a directory, or a drive root.
Const SHGFI_TYPENAME = &H400
Const MAX_PATH = 260
Private Type SHFILEINFO
hIcon As Long ' out: icon
iIcon As Long ' out: icon index
dwAttributes As Long ' out: SFGAO_ flags
szDisplayName As String * MAX_PATH ' out: display name (or path)
szTypeName As String * 80 ' out: type name
End Type
Private Declare Function SHGetFileInfo Lib "shell32.dll" Alias "SHGetFileInfoA" (ByVal pszPath As String, ByVal dwFileAttributes As Long, psfi As SHFILEINFO, ByVal cbFileInfo As Long, ByVal uFlags As Long) As Long
Private Sub Form_Paint()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim FI As SHFILEINFO
'Get file info
SHGetFileInfo "c:\autoexec.bat", 0, FI, Len(FI), SHGFI_DISPLAYNAME Or SHGFI_TYPENAME
Me.Cls
Me.Print "Filename: Autoexec.bat"
Me.Print "Typename: " + StripTerminator(FI.szTypeName)
Me.Print "Displayname: " + StripTerminator(FI.szDisplayName)
End Sub
'This fucntion is used to strip al the unnecessary chr$(0)'s
Function StripTerminator(sInput As String) As String
Dim ZeroPos As Integer
'Search the position of the first chr$(0)
ZeroPos = InStr(1, sInput, vbNullChar)
If ZeroPos > 0 Then
StripTerminator = Left$(sInput, ZeroPos - 1)
Else
StripTerminator = sInput
End If
End Function
No comments have been posted about Retrieves information about an object in the file system, such as a file, a folder, a directory, or. Why not be the first to post a comment about Retrieves information about an object in the file system, such as a file, a folder, a directory, or.