Declare Function GetFileVersionInfo& Lib "version.dll" Alias "GetFileVersionInfoA" (ByVal lptstrFilename As String, ByVal dwHandle As Long, ByVal dwLen As Long, lpData As Byte)以下还有这些可参考
Declare Function GetFileInformationByHandle Lib "kernel32" Alias "GetFileInformationByHandle" (ByVal hFile As Long, lpFileInformation As BY_HANDLE_FILE_INFORMATION) As Long
Declare Function GetFileSize Lib "kernel32" Alias "GetFileSize" (ByVal hFile As Long, lpFileSizeHigh As Long) As Long
Declare Function GetFileTime Lib "kernel32" Alias "GetFileTime" (ByVal hFile As Long, lpCreationTime As FILETIME, lpLastAccessTime As FILETIME, lpLastWriteTime As FILETIME) As Long
Declare Function GetFileType Lib "kernel32" Alias "GetFileType" (ByVal hFile As Long) As Long
Declare Function GetFileInformationByHandle Lib "kernel32" Alias "GetFileInformationByHandle" (ByVal hFile As Long, lpFileInformation As BY_HANDLE_FILE_INFORMATION) As Long
Declare Function GetFileSize Lib "kernel32" Alias "GetFileSize" (ByVal hFile As Long, lpFileSizeHigh As Long) As Long
Declare Function GetFileTime Lib "kernel32" Alias "GetFileTime" (ByVal hFile As Long, lpCreationTime As FILETIME, lpLastAccessTime As FILETIME, lpLastWriteTime As FILETIME) As Long
Declare Function GetFileType Lib "kernel32" Alias "GetFileType" (ByVal hFile As Long) As Long
解决方案 »
- 如何阻止webbrowser加载页面时出现沙漏鼠标指针?
- 想出钱请人做一个小软件,请报价
- 关于SQL2000信任连接的问题,在线等高手指点
- ■■■■加急:sendmessage 怎样在2个程序中传递自定义消息?■■■■在线等待■■■■
- 菜鸟--如何用一个datagrid体现两个表(access2000)的不同字段啊?(100)分
- 请问这个select 问题在哪,提示“)”有问题?
- 如何得到一个表的字段的数据格式,表不是自己建的?
- on error goto 报语法错误
- 怎么样实现把一个表的所有数据插入到另外一个表?
- 如何将超过设定时间一个小时的多个文件夹移动到其他路径下
- 有谁用FORMULA ONE做报表啊?
- 火急问题 -- 高手快帮帮忙
Alias "GetFileVersionInfoA" _
(ByVal lptstrFilename As String, _
ByVal dwhandle As Long, _
ByVal dwlen As Long, _
lpData As Any) As LongPrivate Declare Function GetFileVersionInfoSize Lib "Version.dll" _
Alias "GetFileVersionInfoSizeA" _
(ByVal lptstrFilename As String, _
lpdwHandle As Long) As LongPrivate Declare Function VerQueryValue Lib "Version.dll" _
Alias "VerQueryValueA" _
(pBlock As Any, _
ByVal lpSubBlock As String, _
lplpBuffer As Any, _
puLen As Long) As LongPrivate Declare Function GetSystemDirectory Lib "KERNEL32" _
Alias "GetSystemDirectoryA" _
(ByVal Path As String, _
ByVal cbBytes As Long) As LongPrivate Declare Sub MoveMemory Lib "KERNEL32" _
Alias "RtlMoveMemory" _
(dest As Any, _
ByVal Source As Long, _
ByVal Length As Long)Private Declare Function lstrcpy Lib "KERNEL32" _
Alias "lstrcpyA" _
(ByVal lpString1 As String, _
ByVal lpString2 As Long) As LongPrivate sVersionInfo(11) As StringPublic Enum VersionInfo CompanyName = 0
FileDescription = 1
FileVersion = 2
InternalName = 3
LegalCopyright = 4
OriginalFileName = 5
ProductName = 6
ProductVersion = 7
LegalTrades = 8
PrivateBuild = 9
SpecialBuild = 10
Comments = 11End EnumPublic Function sGetProductProperty(ByVal sFileName As String, ByVal vItem As VersionInfo) As String On Error Resume Next
Dim Buffer As String
Dim nRet As Long
Dim sFullFileName As String
Dim lBufferLen As Long
Dim lDummy As Long
Dim sBuffer() As Byte
Dim lVerPointer As Long
Dim sTemp As String
Dim bytBuffer(255) As Byte
Dim sLang_Charset_String As String
Dim lHexNumber As Long
If sFileName = "" Then
Exit Function
End If '*** Get size ****
lBufferLen = GetFileVersionInfoSize(sFileName, lDummy) If lBufferLen < 1 Then 'MsgBox "No Version Info available!", vbOKOnly + vbExclamation, g_sTitle
Exit Function End If ReDim sBuffer(lBufferLen)
nRet = GetFileVersionInfo(sFileName, _
0&, _
lBufferLen, _
sBuffer(0)) If nRet = 0 Then 'MsgBox "GetFileVersionInfo failed.", vbOKOnly + vbExclamation, g_sTitle
Exit Function End If nRet = VerQueryValue(sBuffer(0), _
"\VarFileInfo\Translation", _
lVerPointer, _
lBufferLen) If nRet = 0 Then 'MsgBox "VerQueryValue failed.", vbOKOnly + vbExclamation, g_sTitle
Exit Function End If 'lVerPointer is a pointer to four 4 bytes of Hex number,
'first two bytes are language id, and last two bytes are code
'page. However, Lang_Charset_String needs a string of
'4 hex digits, the first two characters correspond to the
'language id and last two the last two character correspond
'to the code page id. MoveMemory bytBuffer(0), lVerPointer, lBufferLen lHexNumber = bytBuffer(2) + bytBuffer(3) * &H100 + _
bytBuffer(0) * &H10000 + bytBuffer(1) * &H1000000
sLang_Charset_String = Hex$(lHexNumber)
'now we change the order of the language id and code page
'and convert it into a string representation.
'For example, it may look like 040904E4
'Or to pull it all apart:
'04------ = SUBLANG_ENGLISH_USA
'--09---- = LANG_ENGLISH
'----04E4 = 1252 = Codepage for Windows:Multilingual Do While Len(sLang_Charset_String) < 8 sLang_Charset_String = "0" & sLang_Charset_String Loop
Buffer = String$(255, 0)
sTemp = "\StringFileInfo\" & sLang_Charset_String _
& "\" & "ProductVersion"
nRet = VerQueryValue(sBuffer(0), sTemp, _
lVerPointer, lBufferLen)
If nRet = 0 Then
Buffer = "N/A"
Else
lstrcpy Buffer, lVerPointer
Buffer = Mid$(Buffer, 1, InStr(Buffer, Chr$(0)) - 1)
End If
sGetProductProperty = BufferEnd Function