Not a Member Yet,
Click here to Register
How do you like the new design?
It's cool, great job
[tally: 70%] 70%
It's okay
[tally: 20%] 20%
Its OK but I liked the old layout better
[tally: 0%] 0%
Please bring the old one back
[tally: 10%] 10%

votes: 10

ID: 322
Viewed: 2474
Added: Aug 19, 2002
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Gets File version

Highlight all by clicking in box
'Here, try this, it extracts all the File Information, (Works only On 32-bit Files):
'Add a Textbox, CommandButton And CommonDialogbox To a Form..
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

Highlight All
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
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 = "StringFileInfo40904E4" & 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
End If
End Sub;

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 All Rights Reserved. Conditions