| Public Declare Function GetFileVersionInfoSize Lib "version.dll" Alias _ "GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, _ lpdwHandle As Long) As Long Public 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 Function GetFileVersionData(ByVal FileName As String) As Variant Dim length As Long Dim handle As Long Dim buffer As String Dim index As Long Dim pos As Long length = GetFileVersionInfoSize(FileName, handle) If length = 0 Then Exit Function buffer = Space$(length) If GetFileVersionInfo(FileName, handle, length, ByVal StrPtr(buffer)) = 0 _ Then Exit Function End If Dim res() As String res() = Split("CompanyName;FileDescription;FileVersion;InternalName;" & _ "LegalCopyright;OriginalFilename;ProductName;ProductVersion;" & _ "Comments;LegalTrademarks;PrivateBuild;SpecialBuild", ";") For index = 0 To UBound(res) pos = InStr(buffer, res(index)) If pos Then pos = pos + Len(res(index)) + 1 If Mid$(buffer, pos, 1) = vbNullChar Then pos = pos + 1 res(index) = res(index) & ": " & Mid$(buffer, pos, InStr(pos, _ buffer, vbNullChar) - pos) End If Next GetFileVersionData = res() End Function Dim res As Variant res = GetFileVersionData(sFName) ******** display a line of 16 bytes of data, hex followed by displayable chars Function ByteDisp(ByVal BO As Double, ByVal sIn As String) As String Dim x As Integer Dim sAddr As String Dim sHex As String Dim sChr As String sHex = "" sChr = "" For x = 1 To 32 If x <= Len(sIn) Then sHex = sHex & IIf(Len(Hex$(Asc(Mid(sIn, x, 1)))) = 1, "0", "") & Hex$(Asc(Mid(sIn, x, 1))) & " " sChr = sChr & IIf(Asc(Mid(sIn, x, 1)) < 32 Or Asc(Mid(sIn, x, 1)) > 126, ".", Mid(sIn, x, 1)) Else sHex = sHex & " " sChr = sChr & " " End If Next x sAddr = Hex$(BO) sAddr = String(10 - Len(sAddr), "0") & sAddr ByteDisp = sAddr & " " & sHex & " " & sChr End Function |
Get file version |
Express News India | Freelance ecommerce web development India