GetFileVersionInfo




Private Declare Function GetFileVersionInfo Lib "Version.dll" Alias "GetFileVersionInfoA" (ByVal lptstrFilename As String, ByVal dwHandle As Long, ByVal dwLen As Long, lpData As Any) As Long
Private Declare Function GetFileVersionInfoSize Lib "Version.dll" Alias "GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, lpdwHandle As Long) As Long
Private Declare Function VerQueryValue Lib "Version.dll" Alias "VerQueryValueA" (pBlock As Any, ByVal lpSubBlock As String, lplpBuffer As Any, puLen As Long) As Long
Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (lpString1 As Any, lpString2 As Any) As Long
Private Sub Command1_Click()
Dim sVerInfo(7) As String
Dim sInfo As String
Dim sValue As String
Dim sFile As String
Dim sData() As Byte
Dim lSize As Long
Dim lPointer As Long
Dim iIndex As Integer

On Error GoTo OpenError
With CommonDialog1
.CancelError = True
.ShowOpen
sFile = .FileName
End With
Text1 = ""
'get the Length of the FileVersion Information

lSize = GetFileVersionInfoSize(sFile, ByVal 0&)
'Create a Buffer to hold the Version Info

ReDim sData(lSize)
'get the Version Info

If GetFileVersionInfo(sFile, 0&, lSize, sData(0)) Then
'Extract the Details of the Version Info

sVerInfo(0) = "CompanyName"
sVerInfo(1) = "FileDescription"
sVerInfo(2) = "FileVersion"
sVerInfo(3) = "InternalName"
sVerInfo(4) = "LegalCopyright"
sVerInfo(5) = "OriginalFileName"
sVerInfo(6) = "ProductName"
sVerInfo(7) = "ProductVersion"
For iIndex = 0 To 7
sInfo = "\StringFileInfo\040904E4\" & sVerInfo(iIndex)
If VerQueryValue(sData(0), sInfo, lPointer, lSize) Then
sValue = Space(lSize)
lstrcpy ByVal sValue, ByVal lPointer
Text1.SelText = sVerInfo(iIndex) & ": " & sValue
Text1.SelText = vbCrLf
End If
Next
End If
OpenError:
End Sub

Here, try this, it extracts all the File Information,
(Works only On 32-bit Files):
Add a Textbox, CommandButton And CommonDialogbox To a Form..











( getfileversioninfo.html )- by Paolo Puglisi - Modifica del 17/12/2023