In the properties of an image you can see the bitdepth of the image botn in WinXP and Windows 7.
I'm using the code below to extract the bitdepth of the image in Windows 7 and it works fine.
Using the same code in WinXP is doesn't show the bitdepth although the bitdepth is shown in the properties.
Has anyone an idea how to modify the code to read out the bitdepth in windows 7 and in WinXP ?
I'm using the code below to extract the bitdepth of the image in Windows 7 and it works fine.
Using the same code in WinXP is doesn't show the bitdepth although the bitdepth is shown in the properties.
Has anyone an idea how to modify the code to read out the bitdepth in windows 7 and in WinXP ?
Code:
Option Explicit
Sub RetrievingExtendedFileProperties()
Dim testfile As String
Dim arrHeaders(200)
Dim i As Integer
testfile = "c:\test.tif"
For i = 0 To 200
arrHeaders(i) = GetExtendedProperty(testfile, i)
Next
MsgBox "Bit depth is: " & GetExtendedProperty(testfile, "bitdepth")
End Sub
Private Function GetExtendedProperty(strFile As String, Optional varProperty As Variant = 0) As String
Dim fso As New FileSystemObject
Dim myFolder As String
With New Shell32.Shell
myFolder = fso.GetParentFolderName(strFile)
Select Case TypeName(varProperty)
Case "String"
GetExtendedProperty = .Namespace(myFolder).Items.Item(fso.GetFileName(strFile)).ExtendedProperty(varProperty)
Case "Long", "Integer"
GetExtendedProperty = .Namespace(myFolder).GetDetailsOf(.Namespace(myFolder).ParseName(fso.GetFileName(strFile)), varProperty)
End Select
End With
End Function