- Код: Выделить всё
Private Type VS_FIXEDFILEINFO
dwSignature As Long
dwStrucVersionl As Integer
dwStrucVersionh As Integer
dwFileVersionMSl As Integer
dwFileVersionMSh As Integer
dwFileVersionLSl As Integer
dwFileVersionLSh As Integer
dwProductVersionMSl As Integer
dwProductVersionMSh As Integer
dwProductVersionLSl As Integer
dwProductVersionLSh As Integer
dwFileFlagsMask As Long
dwFileFlags As Long
dwFileOS As Long
dwFileType As Long
dwFileSubtype As Long
dwFileDateMS As Long
dwFileDateLS As Long
End Type
Private Declare Function GetFileVersionInfo Lib "Version.dll" Alias _
"GetFileVersionInfoA" (ByVal lptstrFilename As String, _
ByVal dwHandle As Long, ByVal dwLen As Long, _
lpData As Byte) 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 Byte, ByVal lpSubBlock As String, _
lplpBuffer As Long, puLen As Long) As Long
Private Declare Sub MoveMemory Lib "kernel32" Alias _
"RtlMoveMemory" (dest As Any, ByVal Source As Long, _
ByVal length As Long)
Public Function GetVersion(sPath As String) As String
Dim lLen&, rc&, lVer&, lLenVer&
Dim vVer As VS_FIXEDFILEINFO, bBuffer() As Byte
lLen = GetFileVersionInfoSize(sPath, lLen)
If lLen < 1 Then Exit Function
ReDim bBuffer(lLen)
rc = GetFileVersionInfo(sPath, 0, lLen, bBuffer(0))
rc = VerQueryValue(bBuffer(0), "\", lVer, lLenVer)
MoveMemory vVer, lVer, Len(vVer)
GetVersion = vVer.dwFileVersionMSh & "." & _
vVer.dwFileVersionMSl & "." & vVer.dwFileVersionLSl & "." _
& vVer.dwFileVersionLSh
End Function
Остальное - ищем дружно в API-Guide.