1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
Dim lngSize As Long
Dim lngRet As Long
Dim pBlock() As Byte
Dim lpfi As VS_FIXEDFILEINFO
Dim lppBlock As Long
'GetFileVersionInfo requires us to get the size of the file version information first,
' this info is in the format of VS_FIXEDFILEINFO struct
lngSize = apiGetFileVersionInfoSize(strExeFullPath, lngRet)
'Proceed If the OS can obtain version info.
If lngSize Then
'The info in pBlock is always in Unicode format
ReDim pBlock(lngSize)
lngRet = apiGetFileVersionInfo(strExeFullPath, 0, lngSize, pBlock(0))
If Not lngRet = 0 Then
'The same pointer to pBlock can be passed to VerQueryValue
lngRet = apiVerQueryValue(pBlock(0), "\", lppBlock, lngSize)
'Fill the VS_FIXEDFILEINFO struct with bytes from pBlock
'VerQueryValue fills lngSize with the length of the block.
'FUNCTION QUI CRASH MON APPLICATION
Call sapiCopyMem(lpfi, ByVal lppBlock, lngSize)
'FUNCTION QUI CRASH MON APPLICATION
'Build the version info strings
With lpfi
fGetProductVersion = HIWord(.dwFileVersionMS) & "." & LOWord(.dwFileVersionMS) & "." & _
HIWord(.dwFileVersionLS) & "." & LOWord(.dwFileVersionLS)
End With
End If
End If |
Partager