Not a Member Yet,
Click here to Register
How do you like the new design?






ID: 322
Viewed: 2473
Added: Aug 19, 2002
Version:
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
<!---Declaration--->
'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
<!---Code--->
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 = "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
Next
End If
OpenError:
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 snippetlibrary.com All Rights Reserved. Conditions